DLL32 STATIC FUNCTION UserLogin( UserCode AS STRING,;
UserPasswd AS STRING,;
@UserName AS STRING,;
@ReqPhone1 AS STRING,;
@ReqPhone2 AS STRING,;
@ReqPhone3 AS STRING,;
@TotalPrice AS LONG ,;
@CallPrice AS _INT ) AS _INT LIB AppSMSCall.dll
........
nRet := UserLogin( ::cId, ::cPass, @::cUser, @::cReqTel1, @::cReqTel2, @::cReqTel3, @::nTotAmt, @::nPrice)
=>
#define DC_CALL_STD 0x0020
nRet := DllCall("AppSMSCall.dll", DC_CALL_STD, "UserLogin", ;
::cId, ::cPass, @::cUser, @::cReqTel1, @::cReqTel2, @::cReqTel3, @::nTotAmt, @::nPrice)
DLL STATIC FUNCTION USERLOGIN( UserCode AS LPSTR,;
UserPasswd AS LPSTR,;
@UserName AS LPSTR,;
@ReqPhone1 AS LPSTR,;
@ReqPhone2 AS LPSTR,;
@ReqPhone3 AS LPSTR,;
@TotalPrice AS LONG,;
@CallPrice AS LONG ) AS LONG FROM "UserLogin" LIB "AppSMSCall.dll"
STATIC HLIB
#INCLUDE "FiveWin.ch"
Function Main()
local retval, parm1
hLib := LoadLibrary( "f:\utility\IMAGE2PDF.DLL" ) // set hdll to a handle so recursive loads not required in dll32 function.
// THESE 2 CALLS WORK - no parameters passed within the declaration below
retval := I2PDF_SilentRunning( ) // RETURNS NIL DUE TO VOID DECLARATION BELOW
retval := I2PDF_GetDLLVersion( ) // RETURNS 240 - PROPER Integer returned from DLL
// These 2 calls DO NOT WORK due to passing a parameter.
retval := I2PDF_SetDPI( 0 )
retval := I2PDF_License( "XXX-ZZZZ-AAAAA-BBBBBB-CCCCCCC" )
FreeLibrary( hLib )
RETURN NIL
**********************************************************
// DLL API proptotypes - 1st 2 functions work as they don't pass parms.
// the 2nd one properly returns an interger (240) - proving communication with DLL
// 3rd and 4th calls both produce GPF - common denominator is passing a parm.
DLL STATIC FUNCTION I2PDF_SilentRunning( ) AS LONG;
PASCAL FROM "I2PDF_SilentRunning" LIB hLib
DLL STATIC FUNCTION I2PDF_GetDLLVersion( ) AS LONG;
PASCAL FROM "I2PDF_GetDLLVersion" LIB hLib
DLL STATIC FUNCTION I2PDF_SetDPI( nDpi AS LONG ) AS LONG;
PASCAL FROM "I2PDF_SetDPI" LIB hLib
DLL STATIC FUNCTION I2PDF_License( cLicCode AS LPSTR) AS VOID;
PASCAL FROM "I2PDF_License" LIB hLib
// no PASCAL keyword on any DLL Function declarations
for i := 1 to 1000
retval := I2PDF_GetDLLVersion( )
retval := I2PDF_SilentRunning( )
retval := I2PDF_MetaTextFitBoundingRect( )
retval := I2PDF_MetaMargins( )
retval := I2PDF_UseEMFDeviceSize( )
retval := I2PDF_MetaToNativePDF( )
next
retval := I2PDF_License( "XXX-ZZZZ-AAAAA-BBBBBB-CCCCCCC" ) // works fine without a PASCAL keyword.
// GPF on the next line of code - notice this call worked 1000 times before!
retval := I2PDF_GetDLLVersion( ) // ===> GPF on 1st call AFTER calling DLL with a parameter.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 50 guests