Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can someone help translate a function call to a Delphi d
Message
 
To
08/01/2003 11:09:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00739174
Message ID:
00739567
Views:
30
Hi Tracy,
Your table is a good help but leaves me with more questions if you or others can chime in.
Why does the first function use String and the second function use PChar? Why use one over the other?
And more confusing than that, can you help me with the first function's parameters of Var Response_Code1:Integer and especially Var Ret_Msg:TChar1, which is an array.
How do I call that?
Thanks,
Allen

>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform