vb to foxpro conversion
Posted on 2011-03-04
Can someone help me convert this function call to VFP?
I am calling CBW32.dll which is used with data aquisition card from omega.
VFP is not a specifically supported language but should work.
They give examples of how to use the DLL with C/C++, Visual Basic and Delphi.
the examples are:
int cbDIn(int BoardNum, int PortNum, unsigned short *DataValue)
Function cbDIn(ByVal BoardNum&, ByVal PortNum&, DataValue%) As Long
function cbDIn(BoardNum:Integer; PortNum:Integer; var DataValue:Word):Integer; StdCall;
DataValue=Digital value returned here.
Error code or 0 if no errors
DataValue = place holder for the state of the port - (on or off)
When I issue this from VFP:
DECLARE integer cbDIn IN cbw32.dll integer,integer,integer
nResult = cbDIn(1, 10, DataValue) &&foxpro whines "Declare DLL returned an exception"
If I issue:
DECLARE integer cbDIn IN cbw32.dll integer,integer,string
nResult = cbDIn(1, 10, DataValue)
nResult returns a 0 which means it completed okay but I cant get any value from DataValue. it remains "" no mater whether the port is on or off.
I know parameter 1 and 10 are correct. It seens to have a problem with DataValue.
I think it may have something to do with "unsigned short*DataValue" or maybe the dataValue is binary or somthing. I have been trying differrent stuff for two days and cant read the port.