Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't pass parameter and call function in the DLL
Message
From
31/01/1999 08:33:26
 
 
To
31/01/1999 08:18:04
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00182255
Message ID:
00182259
Views:
17
>I have a DLL that's written in C language.
>The function inside the DLL is :
>>> Get_OpenPort(Channel_Param *channel)
>in c to pass the parameters into function is :
>>> Channel_Param chan1 ;
>>> chan1.BaudRate=Baud9600 /*Baud9600 was define in .h file/
>>> chan1.Port=Com2 /*Com2 was define in .h file and included/
>>> Get_OpenPort(&chan1) /*call the function and pass parameters/
>
>I want to Use VFP to call the DLL and pass the parameters into function.
>I can register the DLL already by used Declare statement , but when i want to call the function and pass parameter i faced a problem.
>Anyone can help me ?

Without knowing what the channel typedef looks like, it'd be tough.

Rather than jerking around with the API, why not just use the MSCOMM32.OCX, that ships with VFP, to manipulate the serial port? It's well-documented, there are examples both here on UT and in the MSDN of how to use it, and you don't have to learn C to use it. To set the baud rate and open COM1:, for example:

oComm = CREATEOBJ('MSCommLib.MSComm')
oComm.CommPort = 1
oComm.Settings = "9600,N,8,1"
oComm.InputLen = 0
? oComm.OpenPort = .T.

Take a look at the MSDN documentation on the MSComm Control; the examples are in VB, but are easy enough to translate to VFP. There are examples here on UT of using the MSComm control; take a look in the FAQ and Files sections.
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