Board index » delphi » Calling a Delphi DLL in Word 97?

Calling a Delphi DLL in Word 97?

I have the following function in Delphi 3:

function RebuildHeader(ID: integer): integer; cdecl;

In word 95, the following declaration in Word successfully called this
function:

Private Declare Function RebuildHeader Lib "PPRESULTSENGINE.DLL" (ByVal ID
As Long) As Long

In Word 97 this no longer works (I get a "Bad DLL calling convention (error
49)). Is the cdecl correct when declaring this DLL function in Delphi, or
should I use stdcall instead? Are the Dephi integer variables still longs in
Word 97? What should the code look like that calls this function from Word
97 (i.e. "Result = RebuildHeader(CaseID)" or "Result = RebuildHeader(ByVal
CaseID)", etc. Thanks in advance.

--------------------------------------
Jeff Davis
jeff.da...@tamtron.com

 

Re:Calling a Delphi DLL in Word 97?


Hello,

Integer in Delphi is Long in VB. You should use stdcall instead of cdecl.
The VBA calling code should be: Result = RebuildHeader(CaseID)

have fun.
--
Binh Ly
Brickhouse Data Systems, Inc.
http://www.brickhouse.com

Quote
Jeff Davis wrote in message <6tbha2$e...@forums.borland.com>...
>I have the following function in Delphi 3:

>function RebuildHeader(ID: integer): integer; cdecl;

>In word 95, the following declaration in Word successfully called this
>function:

>Private Declare Function RebuildHeader Lib "PPRESULTSENGINE.DLL" (ByVal ID
>As Long) As Long

>In Word 97 this no longer works (I get a "Bad DLL calling convention (error
>49)). Is the cdecl correct when declaring this DLL function in Delphi, or
>should I use stdcall instead? Are the Dephi integer variables still longs
in
>Word 97? What should the code look like that calls this function from Word
>97 (i.e. "Result = RebuildHeader(CaseID)" or "Result = RebuildHeader(ByVal
>CaseID)", etc. Thanks in advance.

>--------------------------------------
>Jeff Davis
>jeff.da...@tamtron.com

Re:Calling a Delphi DLL in Word 97?


Thanks. That worked great.

Quote
bly wrote in message <6th2ov$ld...@forums.borland.com>...
>Hello,

>Integer in Delphi is Long in VB. You should use stdcall instead of cdecl.
>The VBA calling code should be: Result = RebuildHeader(CaseID)

>have fun.
>--
>Binh Ly
>Brickhouse Data Systems, Inc.
>http://www.brickhouse.com
>Jeff Davis wrote in message <6tbha2$e...@forums.borland.com>...
>>I have the following function in Delphi 3:

>>function RebuildHeader(ID: integer): integer; cdecl;

>>In word 95, the following declaration in Word successfully called this
>>function:

>>Private Declare Function RebuildHeader Lib "PPRESULTSENGINE.DLL" (ByVal ID
>>As Long) As Long

>>In Word 97 this no longer works (I get a "Bad DLL calling convention
(error
>>49)). Is the cdecl correct when declaring this DLL function in Delphi, or
>>should I use stdcall instead? Are the Dephi integer variables still longs
>in
>>Word 97? What should the code look like that calls this function from Word
>>97 (i.e. "Result = RebuildHeader(CaseID)" or "Result = RebuildHeader(ByVal
>>CaseID)", etc. Thanks in advance.

>>--------------------------------------
>>Jeff Davis
>>jeff.da...@tamtron.com

Other Threads