Information générale
Catégorie:
Fonctions Windows API
>Ed Raud,
> Let me show you the .h files which consist the tydef of the structure :
>Below is the first .h file "gpl32.h":
>>typedef unsigned char WORD8;
>>typedef unsigned int WORD16;
>>typedef unsigned long WORD32;
>>typedef signed int INT16;
>>typedef unsigned char BYTE;
>
>>struct Channel
>>{
>> WORD8 Nb;
>> WORD8 ReaderType;
>> INT16 ReaderPort;
>> WORD32 BaudRate;
>>};
>
>>typedef struct Channel CHANNEL_PARAM;
>>INT16 _stdcall G_OpenChannel(CHANNEL_PARAM *Channel); /* function call*/
>
>the second .h file "v100_32.h"
>>#define Baud9600 5
>>#define COM2 1
>
>below is the parameters want to pass when call the function:
>>CHANNEL_PARAM Chan1;
>>Chan1.BaudRate=Baud9600;
>>Chan1.ReaderPort=Com2;
>>G_openChannel(&Chan1)
>
>How to call and pass the parameters to the function in the .DLL (v10032.dll) in VFP?
If you download my Pointers class from the Files section, you'll find a NumberConversion class in the Pointers.vcx library. Use the conversion methods to translate your numeric values to char strings, concatenate them and pass the resulting string by reference to the dll function:
DECLARE G_openChannel IN v10032.dll STRING @cChannel
SET CLASSLIB TO Pointers ADDITIVE
oConv = CreateObject("NumberConversion")
lcChannel = oConv.NumberToInteger1String(0) + ;
oConv.NumberToInteger1String(0) + ;
oConv.NumberToInteger2String(1) + ;
oConv.NumberToInteger4String(5)
= G_openChannel(@lcChannel)
If this doesn't work, the problem may be that the dll was recompiled for Win32. In this case, change the NumberToInteger2String from above with NumberToInteger4String.
>is it i need to include the .h file in the VFP program ?
No.
Vlad
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement