471,342 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,342 software developers and data experts.

External dll

Hi!

I have a problem in calling a function from an external dll source.
Prototype for a function is given in vb code

Declare Function GetMessageData Lib "c:\windows\system\smartdll.dll" (ByVal
theLength As Integer, ByRef theMessageLength As Integer, ByVal
theMessageData As String) As Integer

I would like to call this funcition from c# and I just can't seem to get a
hang of it...
Manufacturer description is very scarce...
Where should I use the string, or do I need StringBuilder, can anyone help?

Thanks,
Marino
Jun 27 '08 #1
7 1503
On Jun 10, 8:52 am, "Marino" <mar...@dir.hrwrote:
Hi!

I have a problem in calling a function from an external dll source.
Prototype for a function is given in vb code

Declare Function GetMessageData Lib "c:\windows\system\smartdll.dll" (ByVal
theLength As Integer, ByRef theMessageLength As Integer, ByVal
theMessageData As String) As Integer
I suspect that your problem comes from "ByRef theMessageLength As
Integer",
you should call the finction with (theLength, ref theMessageLength,
theMessageData)
see REF before theMessageLength
>
I would like to call this funcition from c# and I just can't seem to get a
hang of it...
Manufacturer description is very scarce...
Where should I use the string, or do I need StringBuilder, can anyone help?

Thanks,
Marino
Jun 27 '08 #2
On Jun 10, 3:52*am, "Marino" <mar...@dir.hrwrote:
Hi!

I have a problem in calling a function from an external dll source.
Prototype for a function is given in vb code

Declare Function GetMessageData Lib "c:\windows\system\smartdll.dll" (ByVal
theLength As Integer, ByRef theMessageLength As Integer, ByVal
theMessageData As String) As Integer

I would like to call this funcition from c# and I just can't seem to get a
hang of it...
Manufacturer description is very scarce...
Where should I use the string, or do I need StringBuilder, can anyone help?

Thanks,
Marino
Does the function works in VB?
Is that VB.NET or VB6?

What kind of dll is it? Is it a win32 one or a COM dll?
Jun 27 '08 #3
Yes, that seems to be the problem. Thank you!
Even though that works in some functions, while other have problems.
I am currently thinking that the problem is within incompatibile types,
because I am programming in .net while this dll seems to function the best
in "old" languages...
Will keep trying...

"GArlington" <ga********@tiscali.co.ukwrote in message
news:af**********************************@s50g2000 hsb.googlegroups.com...
On Jun 10, 8:52 am, "Marino" <mar...@dir.hrwrote:
>Hi!

I have a problem in calling a function from an external dll source.
Prototype for a function is given in vb code

Declare Function GetMessageData Lib "c:\windows\system\smartdll.dll"
(ByVal
theLength As Integer, ByRef theMessageLength As Integer, ByVal
theMessageData As String) As Integer
I suspect that your problem comes from "ByRef theMessageLength As
Integer",
you should call the finction with (theLength, ref theMessageLength,
theMessageData)
see REF before theMessageLength
>>
I would like to call this funcition from c# and I just can't seem to get
a
hang of it...
Manufacturer description is very scarce...
Where should I use the string, or do I need StringBuilder, can anyone
help?

Thanks,
Marino

Jun 27 '08 #4
Marino wrote:
Yes, that seems to be the problem. Thank you!
Even though that works in some functions, while other have problems.
I am currently thinking that the problem is within incompatibile
types, because I am programming in .net while this dll seems to
function the best in "old" languages...
Will keep trying...
VB6 Integer is .NET System.Int16, not the same as C# int (which is
System.Int32)

That may be your problem.
>
"GArlington" <ga********@tiscali.co.ukwrote in message
news:af**********************************@s50g2000 hsb.googlegroups.com...
>On Jun 10, 8:52 am, "Marino" <mar...@dir.hrwrote:
>>Hi!

I have a problem in calling a function from an external dll source.
Prototype for a function is given in vb code

Declare Function GetMessageData Lib "c:\windows\system\smartdll.dll"
(ByVal
theLength As Integer, ByRef theMessageLength As Integer, ByVal
theMessageData As String) As Integer
I suspect that your problem comes from "ByRef theMessageLength As
Integer",
you should call the finction with (theLength, ref theMessageLength,
theMessageData)
see REF before theMessageLength
>>>
I would like to call this funcition from c# and I just can't seem
to get a
hang of it...
Manufacturer description is very scarce...
Where should I use the string, or do I need StringBuilder, can
anyone help?

Thanks,
Marino

Jun 27 '08 #5
This solved the problem... Strange dll, it references as though params are
long, but in some params it only accepts int16, in some int and in some
long... Very strange..

Thank you a bunch for your help!!

"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:Oc**************@TK2MSFTNGP06.phx.gbl...
Marino wrote:
>Yes, that seems to be the problem. Thank you!
Even though that works in some functions, while other have problems.
I am currently thinking that the problem is within incompatibile
types, because I am programming in .net while this dll seems to
function the best in "old" languages...
Will keep trying...

VB6 Integer is .NET System.Int16, not the same as C# int (which is
System.Int32)

That may be your problem.
>>
"GArlington" <ga********@tiscali.co.ukwrote in message
news:af**********************************@s50g200 0hsb.googlegroups.com...
>>On Jun 10, 8:52 am, "Marino" <mar...@dir.hrwrote:
Hi!

I have a problem in calling a function from an external dll source.
Prototype for a function is given in vb code

Declare Function GetMessageData Lib "c:\windows\system\smartdll.dll"
(ByVal
theLength As Integer, ByRef theMessageLength As Integer, ByVal
theMessageData As String) As Integer
I suspect that your problem comes from "ByRef theMessageLength As
Integer",
you should call the finction with (theLength, ref theMessageLength,
theMessageData)
see REF before theMessageLength

I would like to call this funcition from c# and I just can't seem
to get a
hang of it...
Manufacturer description is very scarce...
Where should I use the string, or do I need StringBuilder, can
anyone help?

Thanks,
Marino


Jun 27 '08 #6
Marino wrote:
This solved the problem... Strange dll, it references as though
params are long, but in some params it only accepts int16, in some
int and in some long... Very strange..
I highly doubt that any of the parameters are a C# long (System.Int64).
LONG in C++ and Long in VB6 are the same as .NET System.Int32.
>
Thank you a bunch for your help!!

"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:Oc**************@TK2MSFTNGP06.phx.gbl...
>Marino wrote:
>>Yes, that seems to be the problem. Thank you!
Even though that works in some functions, while other have problems.
I am currently thinking that the problem is within incompatibile
types, because I am programming in .net while this dll seems to
function the best in "old" languages...
Will keep trying...

VB6 Integer is .NET System.Int16, not the same as C# int (which is
System.Int32)

That may be your problem.
>>>
"GArlington" <ga********@tiscali.co.ukwrote in message
news:af**********************************@s50g20 00hsb.googlegroups.com...
On Jun 10, 8:52 am, "Marino" <mar...@dir.hrwrote:
Hi!
>
I have a problem in calling a function from an external dll
source. Prototype for a function is given in vb code
>
Declare Function GetMessageData Lib
"c:\windows\system\smartdll.dll" (ByVal
theLength As Integer, ByRef theMessageLength As Integer, ByVal
theMessageData As String) As Integer
I suspect that your problem comes from "ByRef theMessageLength As
Integer",
you should call the finction with (theLength, ref theMessageLength,
theMessageData)
see REF before theMessageLength
>
I would like to call this funcition from c# and I just can't seem
to get a
hang of it...
Manufacturer description is very scarce...
Where should I use the string, or do I need StringBuilder, can
anyone help?
>
Thanks,
Marino

Jun 27 '08 #7
Seems strange to me to, but if I use any other filetype other than long it
doesn''t work...

"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Marino wrote:
>This solved the problem... Strange dll, it references as though
params are long, but in some params it only accepts int16, in some
int and in some long... Very strange..

I highly doubt that any of the parameters are a C# long (System.Int64).
LONG in C++ and Long in VB6 are the same as .NET System.Int32.
>>
Thank you a bunch for your help!!

"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:Oc**************@TK2MSFTNGP06.phx.gbl...
>>Marino wrote:
Yes, that seems to be the problem. Thank you!
Even though that works in some functions, while other have problems.
I am currently thinking that the problem is within incompatibile
types, because I am programming in .net while this dll seems to
function the best in "old" languages...
Will keep trying...

VB6 Integer is .NET System.Int16, not the same as C# int (which is
System.Int32)

That may be your problem.
"GArlington" <ga********@tiscali.co.ukwrote in message
news:af**********************************@s50g2 000hsb.googlegroups.com...
On Jun 10, 8:52 am, "Marino" <mar...@dir.hrwrote:
>Hi!
>>
>I have a problem in calling a function from an external dll
>source. Prototype for a function is given in vb code
>>
>Declare Function GetMessageData Lib
>"c:\windows\system\smartdll.dll" (ByVal
>theLength As Integer, ByRef theMessageLength As Integer, ByVal
>theMessageData As String) As Integer
I suspect that your problem comes from "ByRef theMessageLength As
Integer",
you should call the finction with (theLength, ref theMessageLength,
theMessageData)
see REF before theMessageLength
>>
>I would like to call this funcition from c# and I just can't seem
>to get a
>hang of it...
>Manufacturer description is very scarce...
>Where should I use the string, or do I need StringBuilder, can
>anyone help?
>>
>Thanks,
>Marino


Jun 27 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by bba | last post: by
1 post views Thread by Aravind | last post: by
3 posts views Thread by al.cpwn | last post: by
6 posts views Thread by sadegh | last post: by
debasisdas
reply views Thread by debasisdas | last post: by
reply views Thread by Ryan Gaffuri | last post: by
2 posts views Thread by =?Utf-8?B?YmFzaA==?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.