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