 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Shawn Call Guest
|
Posted: Sun Dec 14, 2003 4:42 am Post subject: Help writing interface to VB Dll - Not Correctly Sending Dat |
|
|
I'm trying to interface a VB DLL to Delphi. I wrote the interface, but
found it was not sending the long data type correctly to the VB
Component. I worked with the DLL developer, who recompiled the code to
send me back what it received, that's when I discovered the data was
not coming across correctly.
Here's my interface code:
implementation
function StartRemote (var control: longint): longint; stdcall;
external 'PBRemote.dll' name 'StartRemote';
function GetRemote(): longint; stdcall; external 'PBRemote.dll' name
'GetRemote';
When I send a value '2' to the StartRemote function, it returns back
the number 1,242,552. It should have sent back a '2'. This leads me to
believe there is a problem with my interface. How can I fix this?
Here's the interface of the VB Component I'm calling:
Declare Function StartRemote Lib "PBRemote.dll" (ByVal CommPort As
Long) As
Long
Declare Function GetRemote Lib "PBRemote.dll" () As Long
Can anyone give me some suggestions on why this is failing in Delphi.
Thanks,
-Shawn
|
|
| Back to top |
|
 |
Messtechnik Beratung Guest
|
Posted: Sun Dec 14, 2003 1:09 pm Post subject: Re: Help writing interface to VB Dll - Not Correctly Sending |
|
|
Shawn Call wrote:
| Quote: | I'm trying to interface a VB DLL to Delphi. I wrote the interface, but
found it was not sending the long data type correctly to the VB
Component. I worked with the DLL developer, who recompiled the code to
send me back what it received, that's when I discovered the data was
not coming across correctly.
Here's my interface code:
implementation
function StartRemote (var control: longint): longint; stdcall;
external 'PBRemote.dll' name 'StartRemote';
function GetRemote(): longint; stdcall; external 'PBRemote.dll' name
'GetRemote';
When I send a value '2' to the StartRemote function, it returns back
the number 1,242,552. It should have sent back a '2'. This leads me to
believe there is a problem with my interface. How can I fix this?
Here's the interface of the VB Component I'm calling:
Declare Function StartRemote Lib "PBRemote.dll" (ByVal CommPort As
Long) As
Long
Declare Function GetRemote Lib "PBRemote.dll" () As Long
Can anyone give me some suggestions on why this is failing in Delphi.
Thanks,
-Shawn
|
Hi Shawn,
try
Declare Function StartRemote Lib "PBRemote.dll" (ByRef CommPort As Long)
As Long
or remove var at
function StartRemote (__var__ control: longint): longint; stdcall;
Sincerly
Gerhard
|
|
| Back to top |
|
 |
Shawn Call Guest
|
Posted: Mon Dec 15, 2003 1:19 am Post subject: Re: Help writing interface to VB Dll - Not Correctly Sending |
|
|
Thanks! Removing "var" from the following fixed the problem!!
function StartRemote (control: longint): longint; stdcall;
Messtechnik Beratung <messtechnik_beratung (AT) web (DOT) de> wrote
| Quote: | Shawn Call wrote:
I'm trying to interface a VB DLL to Delphi. I wrote the interface, but
found it was not sending the long data type correctly to the VB
Component. I worked with the DLL developer, who recompiled the code to
send me back what it received, that's when I discovered the data was
not coming across correctly.
Here's my interface code:
implementation
function StartRemote (var control: longint): longint; stdcall;
external 'PBRemote.dll' name 'StartRemote';
function GetRemote(): longint; stdcall; external 'PBRemote.dll' name
'GetRemote';
When I send a value '2' to the StartRemote function, it returns back
the number 1,242,552. It should have sent back a '2'. This leads me to
believe there is a problem with my interface. How can I fix this?
Here's the interface of the VB Component I'm calling:
Declare Function StartRemote Lib "PBRemote.dll" (ByVal CommPort As
Long) As
Long
Declare Function GetRemote Lib "PBRemote.dll" () As Long
Can anyone give me some suggestions on why this is failing in Delphi.
Thanks,
-Shawn
Hi Shawn,
try
Declare Function StartRemote Lib "PBRemote.dll" (ByRef CommPort As Long)
As Long
or remove var at
function StartRemote (__var__ control: longint): longint; stdcall;
Sincerly
Gerhard
|
|
|
| Back to top |
|
 |
Tony J Hopkinson Guest
|
Posted: Mon Dec 15, 2003 8:39 pm Post subject: Re: Help writing interface to VB Dll - Not Correctly Sending |
|
|
On 13 Dec 2003 20:42:46 -0800, [email]calls (AT) mama (DOT) indstate.edu[/email] (Shawn Call)
wrote:
| Quote: | I'm trying to interface a VB DLL to Delphi. I wrote the interface, but
found it was not sending the long data type correctly to the VB
Component. I worked with the DLL developer, who recompiled the code to
send me back what it received, that's when I discovered the data was
not coming across correctly.
Here's my interface code:
implementation
function StartRemote (var control: longint): longint; stdcall;
external 'PBRemote.dll' name 'StartRemote';
function GetRemote(): longint; stdcall; external 'PBRemote.dll' name
'GetRemote';
When I send a value '2' to the StartRemote function, it returns back
the number 1,242,552. It should have sent back a '2'. This leads me to
believe there is a problem with my interface. How can I fix this?
Here's the interface of the VB Component I'm calling:
Declare Function StartRemote Lib "PBRemote.dll" (ByVal CommPort As
Long) As
Long
Declare Function GetRemote Lib "PBRemote.dll" () As Long
Can anyone give me some suggestions on why this is failing in Delphi.
Thanks,
-Shawn
|
You might want to use the cdecl instead stdcall, cdecl is for
accessing librariries written in C/C++ and it seems likely that VB
would follow the same methodology.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|