IonicWind Software

IWBasic => General Questions => Topic started by: Techno on January 30, 2009, 02:05:46 PM

Title: include file for mpusbapi.inc
Post by: Techno on January 30, 2009, 02:05:46 PM
Dear Programmers

I have needed this include file and I try to translate this include file the original version c++ into ebasic.
Paul can you look to this include file if that is corrected translated for use in ebasic?


'=============================================================================================================='
'The Library mpusbapi.dll    '
'=============================================================================================================='

'private static extern DWORD _MPUSBGetDLLVersion();
DECLARE IMPORT, _MPUSBGetDLLVersion(), UINT
'private static extern DWORD _MPUSBGetDeviceCount(string pVID_PID);
DECLARE IMPORT, _MBUSBGetDeviceCount(pVID_PID AS STRING), UINT
'private static extern void* _MPUSBOpen(DWORD instance,string pVID_PID,string pEP,DWORD dwDir,DWORD dwReserved);
DECLARE IMPORT, _MPUSBOpen(instance AS UINT, pVID_PID AS STRING, pEP AS STRING, dwDir AS UINT, dwReserved AS UINT), POINTER
'private static extern DWORD _MPUSBRead(void* handle,void* pData,DWORD dwLen,DWORD* pLength,DWORD dwMilliseconds);
DECLARE IMPORT, _MPUSBRead(handle AS POINTER, pData AS POINTER, dwLen AS UINT, UINT POINTER AS pLength, dwMilliseconds AS UINT) 
'private static extern DWORD _MPUSBWrite(void* handle,void* pData,DWORD dwLen,DWORD* pLength,DWORD dwMilliseconds);
DECLARE IMPORT, _MPUSBWrite(handle AS POINTER, pData AS POINTER, dwLen AS UINT, UINT POINTER AS pLength, dwMilliseconds AS UINT) 
'private static extern DWORD _MPUSBReadInt(void* handle,DWORD dwLen,DWORD* pLength,DWORD dwMilliseconds);
DECLARE IMPORT, _MPUSBReadInt(handle AS POINTER, pData AS POINTER, dwLen AS UINT, UINT POINTER AS pLength, dwMilliseconds AS UINT) 
'private static extern DWORD _MPUSBWriteInt(void* handle,void* pData,DWORD dwLen,DWORD* pLength,DWORD dwMilliseconds);
DECLARE IMPORT, _MPUSBWriteInt(handle AS POINTER, pData AS POINTER, dwLen AS UINT, UINT POINTER AS pLength, dwMilliseconds AS UINT) 
'private static extern bool _MPUSBClose(void* handle);
DECLARE IMPORT, _MPUSBClose(handle AS POINTER), INT


Title: Re: include file for mpusbapi.inc
Post by: sapero on January 30, 2009, 04:31:12 PM
Techno, replace all "UINT POINTER" with POINTER. Insert CDECL between DECLARE and IMPORT.
MPUSBGetDLLVersion, MPUSBGetDeviceCount, MPUSBRead, MPUSBWrite and MPUSBReadInt are returning a UINT (MPUSB_FAIL or MPUSB_SUCCESS).
DECLARE CDECL IMPORT, _MPUSBWrite(handle AS POINTER, pData AS POINTER, dwLen AS UINT, pLength AS POINTER, dwMilliseconds AS UINT),UINT
Title: Re: include file for mpusbapi.inc
Post by: Techno on January 30, 2009, 05:18:23 PM
Sapero

Thanks
Can you please written an demo for testing this functions?


'=============================================================================================================='
'The Library mpusbapi.dll    '
'=============================================================================================================='

'private static extern DWORD _MPUSBGetDLLVersion();
DECLARE CDECL IMPORT, _MPUSBGetDLLVersion(), UINT
'private static extern DWORD _MPUSBGetDeviceCount(string pVID_PID);
DECLARE CDECL IMPORT, _MBUSBGetDeviceCount(pVID_PID AS STRING), UINT
'private static extern void* _MPUSBOpen(DWORD instance,string pVID_PID,string pEP,DWORD dwDir,DWORD dwReserved);
DECLARE CDECL IMPORT, _MPUSBOpen(instance AS UINT, pVID_PID AS STRING, pEP AS STRING, dwDir AS UINT, dwReserved AS UINT),POINTER
'private static extern DWORD _MPUSBRead(void* handle,void* pData,DWORD dwLen,DWORD* pLength,DWORD dwMilliseconds);
DECLARE CDECL IMPORT, _MPUSBRead(handle AS POINTER, pData AS POINTER, dwLen AS UINT, POINTER AS pLength, dwMilliseconds AS UINT),UINT 
'private static extern DWORD _MPUSBWrite(void* handle,void* pData,DWORD dwLen,DWORD* pLength,DWORD dwMilliseconds);
DECLARE CDECL IMPORT, _MPUSBWrite(handle AS POINTER, pData AS POINTER, dwLen AS UINT, POINTER AS pLength, dwMilliseconds AS UINT),UINT 
'private static extern DWORD _MPUSBReadInt(void* handle,DWORD dwLen,DWORD* pLength,DWORD dwMilliseconds);
DECLARE CDECL IMPORT, _MPUSBReadInt(handle AS POINTER, pData AS POINTER, dwLen AS UINT, POINTER AS pLength, dwMilliseconds AS UINT),UINT 
'private static extern DWORD _MPUSBWriteInt(void* handle,void* pData,DWORD dwLen,DWORD* pLength,DWORD dwMilliseconds);
DECLARE CDECL IMPORT, _MPUSBWriteInt(handle AS POINTER, pData AS POINTER, dwLen AS UINT, POINTER AS pLength, dwMilliseconds AS UINT),UINT 
'private static extern bool _MPUSBClose(void* handle);
DECLARE CDECL IMPORT, _MPUSBClose(handle AS POINTER), INT