May 04, 2024, 11:12:48 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


include file for mpusbapi.inc

Started by Techno, January 30, 2009, 02:05:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Techno

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



sapero

January 30, 2009, 04:31:12 PM #1 Last Edit: January 30, 2009, 04:33:18 PM by sapero
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

Techno

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