Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't pass parameter and call function in the DLL
Message
From
02/02/1999 10:22:26
 
 
To
01/02/1999 23:28:14
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00182255
Message ID:
00182932
Views:
16
>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;
>>};
>

This channel structure will be created as a string; the first byte will be the Nb value, the second byte, the ReaderType value, the next two bytes are the Readerport as a signed integer, and the last 4 bytes are a DWORD representing baud rate. The functions for converting numbers to various binary forms are available in my CLSHEAP.PRG, as well as functions to change them back when you receive and parse this structure,

>>typedef struct Channel CHANNEL_PARAM;
>>INT16 _stdcall G_OpenChannel(CHANNEL_PARAM *Channel); /* function call*/
>

DECLARE SHORT G_OpenChannel IN STRING @ Channel

>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;

If these were the only parameters, you'd build the structure using the functions in CLSHEAP by:

Chan1 = CHR(8) + CHR(1) + NumToBININT(1) + NumToDWORD(5)

I'm guessing at the value for Nb (usually it the structure length, but it could be something different), and ReaderType (no values are given).

>>G_openChannel(&Chan1)

=G_openChannel(@Chan1)

>
>How to call and pass the parameters to the function in the .DLL (v10032.dll) in VFP?

I answered above. You're on your own, now.

>is it i need to include the .h file in the VFP program ?

The .H file uses C notation. If you intend to use any of the constants defined in the .H file, you'll need to construct one that's VFP-complant.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform