API Declarations

fredriko

Active member
Joined
Jun 3, 2004
Messages
35
Programming Experience
10+
I am writing an application that requires integration with a third party piece of hardware. The hardware has a API defined that allows me to use the hardware. Unfortunately I am struggling badly trying to write the correct declaration for each API Call in VB2005. I've looked all over the place to try and find the equivilent VB calls. I have managed to get the GetAdapterInfo call to work however no matter what I do, I always get a "Arithmetic operation resulted in overflow" error from the GetAdapterState API Call. I believe its something to do with using the wrong data types when defining the structures or calls but I'm not sure. Here is what I'm trying to call.
VB.NET:
DWORD APIENTRY SeaIo_GetAdapterInfo(HANDLE hDevice, ADAPTER_INFO *pAdapterInfo)
DWORD APIENTRY SeaIo_GetAdapterState(HANDLE hDevice, ADAPTER_STATE *pAdapterInfo)
And here are the type definitions used
VB.NET:
typedef struct tagADAPTER_INFO {	
	DWORD	dwReserved0;	
	DWORD	dwReserved1;	
	DWORD	dwReserved2;		
	UCHAR	ucReserved0;	
	UCHAR	ucReserved1;	
	UCHAR	ucDigitalToAnalogChannelCount;	
	UCHAR	ucAnalogToDigitalChannelCount;	
	DWORD	dwStateCapabilities;	
	WORD	wCardNumber;	
	WORD	wBaseIO;	
	UCHAR	ucPortInCount;	
	UCHAR	ucPortOutCount;	
	UCHAR	ucPortCount;	
	UCHAR	ucEnabled;	
	WORD	wIRQ;
} ADAPTER_INFO, *pADAPTER_INFO;
typedef struct ADAPTER_STATE {	
	struct {
		UCHAR 	LogicMode:	1;		
		UCHAR 	Reserved0: 	7;		
		UCHAR 	Reserved1: 	8;		
		UCHAR 	Reserved2: 	8;				
		} infoBits;            	
	DWORD	dwOutputPreset;	
	DWORD	dwInterruptBufferSize;	
	DWORD	dwInterruptControlWord;	
	DWORD	dwSampleInterval;	
	UCHAR	ucModeCW[MAXMODECW];	
	UCHAR ucAIRange[MAXAIChannels];
} ADAPTER_STATE, *pADAPTER_STATE;
 
Back
Top