G
Guest
I am trying to obtain a list of HID devices and am trying to use UINT
GetRawInputDeviceList( PRAWINPUTDEVICELIST pRawInputDeviceList,
PUINT puiNumDevices, UINT cbSize);
a USER32.dll. but the function fails. Here is the code. I am new to
Marshalling. Can anyone suggest my error and why? I am using C# with Visual
Studio 2003 with 1.1 .NET
Code:
/*typedef struct tagRAWINPUTDEVICELIST {
HANDLE hDevice;
DWORD dwType;
} RAWINPUTDEVICELIST, *PRAWINPUTDEVICELIST;
*/
converts to :
[ StructLayout( LayoutKind.Sequential )]
public class RAWINPUTDEVICELIST
{
public IntPtr Device;
public int Type;
}
and
RAWINPUTDEVICELIST pRawInputDeviceList;
/*UINT GetRawInputDeviceList( PRAWINPUTDEVICELIST
pRawInputDeviceList,
PUINT puiNumDevices, UINT cbSize);*/
converts to:
[ DllImport( "C:Windows\\System32\\USER32.DLL" )]
public static extern uint GetRawInputDeviceList( [In, Out]
RAWINPUTDEVICELIST pRawInputDeviceList,[In, Out] uint NumDevices,uint size );
and the call:
uint bb = GetRawInputDeviceList( pRawInputDeviceList, NumDevices, size );
fails and I get the following error:
Unable to load DLL (C:Windows\System32\USER32.DLL).
any suggestions??
GetRawInputDeviceList( PRAWINPUTDEVICELIST pRawInputDeviceList,
PUINT puiNumDevices, UINT cbSize);
a USER32.dll. but the function fails. Here is the code. I am new to
Marshalling. Can anyone suggest my error and why? I am using C# with Visual
Studio 2003 with 1.1 .NET
Code:
/*typedef struct tagRAWINPUTDEVICELIST {
HANDLE hDevice;
DWORD dwType;
} RAWINPUTDEVICELIST, *PRAWINPUTDEVICELIST;
*/
converts to :
[ StructLayout( LayoutKind.Sequential )]
public class RAWINPUTDEVICELIST
{
public IntPtr Device;
public int Type;
}
and
RAWINPUTDEVICELIST pRawInputDeviceList;
/*UINT GetRawInputDeviceList( PRAWINPUTDEVICELIST
pRawInputDeviceList,
PUINT puiNumDevices, UINT cbSize);*/
converts to:
[ DllImport( "C:Windows\\System32\\USER32.DLL" )]
public static extern uint GetRawInputDeviceList( [In, Out]
RAWINPUTDEVICELIST pRawInputDeviceList,[In, Out] uint NumDevices,uint size );
and the call:
uint bb = GetRawInputDeviceList( pRawInputDeviceList, NumDevices, size );
fails and I get the following error:
Unable to load DLL (C:Windows\System32\USER32.DLL).
any suggestions??