By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,491 Members | 1,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,491 IT Pros & Developers. It's quick & easy.

Interop question

P: n/a
[ StructLayout( LayoutKind.Sequential )]
public class RAWINPUTDEVICELIST
{
public IntPtr Device;
public int Type;
}

[ DllImport( "user32.DLL",EntryPoint="GetRawInputDeviceList " )]

public static extern uint GetRawInputDeviceList([In, Out] RAWINPUTDEVICELIST
pRawInputDeviceList, ref uint NumDevices,uint size );

RAWINPUTDEVICELIST pRawInputDeviceList = new RAWINPUTDEVICELIST();

size =
(uint)System.Runtime.InteropServices.Marshal.SizeO f(pRawInputDeviceList);

uint bb = GetRawInputDeviceList( null,ref NumDevices,size); // this returns
4 for NumDevices which is correct.

bb = GetRawInputDeviceList(pRawInputDeviceList,ref NumDevices,size);

What I can not figure out is how to set up the pRawInputDeviceList as a
pointer to a buffer that holds and array of RAWINPUTDEVICELIST structures.
Can you help? If I call the fuction as written I get just one of the
RawInputDevices not the array?

--
BP
Jul 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
>What I can not figure out is how to set up the pRawInputDeviceList as a
pointer to a buffer that holds and array of RAWINPUTDEVICELIST structures.
Can you help?
Change RAWINPUTDEVICELIST to a struct. Change the parameter type to
RAWINPUTDEVICELIST[].
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 11 '06 #2

P: n/a
Thanks for your help. --
BP
"Mattias Sjögren" wrote:
>
What I can not figure out is how to set up the pRawInputDeviceList as a
pointer to a buffer that holds and array of RAWINPUTDEVICELIST structures.
Can you help?

Change RAWINPUTDEVICELIST to a struct. Change the parameter type to
RAWINPUTDEVICELIST[].
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.