Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can someone help translate a function call to a Delphi d
Message
From
08/01/2003 11:09:41
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00739174
Message ID:
00739328
Views:
27
Here is a DLL that I call from both Delphi and VFP with the calling code for each language - Delphi's uses pchar. Perhaps it will help get you started:

In Delphi:
Function CheckCode(name,code:Pchar):Boolean;stdcall;external 'Accesspt.dll'

The same in VFP:
DECLARE INTEGER CheckCode IN Accesspt.DLL STRING Name, String Code

A chart I've had for Equivalents in Data Types (probably out of date!):
C			Visual Basic		Visual Basic	VFP		Delphi
	    		16 bits		    	32 bits

short			integer			integer		short		smallint
int			integer			long		integer		integer
long			long			long		long		longint
unsigned short		integer 1		integer	1	short 1		word
unsigned int		integer	1		long 1		integer	1	cardinal
unsigned long		long 1			long 1		long 1		longint 2
char			string*1		string*1	string*1	char
unsigned char		string*1		string*1	string*1	byte
char*			string			string		string		pchar
(1) Visual Basic and Visual FoxPro do not support unsigned integers. The closest type of data is used.
(2) Delphi does not support unsigned long integers in 16 bits. In 32 bits it can be replaced by the Cardinal type of data.

HTH,
Tracy

>Hi,
>Below are two functions of a dll that I need to call. Can anyone help me translate them into Foxpro Declare statements. I don't know what to do with the Var lines, or the arrays. And what's a PChar data type?
>Thanks,
>Allen
>
>First function:
>
>function Authorize_Trans(
>Store_No:String;
>Trans_No:String;
>Cust_Data:String;
>Trans_Amt:String;
>Var Response_Code1:Integer;
>Var Response_Code2:Integer;
>Var Ret_Msg:TChar1;
>Var Server_Msg:TChar2
>):integer
>
>Where TChar1 and TChar2 are:
>TChar1=Array[0..1024] of char;
>TChar2=Array[0..400] of char;
>
>Second function:
>
>function Submit_Trans(
>Store_No:Pchar;
>Trans_No:Pchar;
>Auth_Code:Pchar;
>Trans_Amt:Pchar;
>Var A:Integer;
>Var B:Integer;
>Var Ret_Msg:TChar1
>):integer
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform