473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Interop question

[ 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
2 1394
>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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Le Thanh Thuan | last post by:
In my VB.Net project, I using Interop.Excel 11.0 (Excel 2003 I create Setup project in my computer, and then , I setup in another computer using Excel 2000 When I run my application, a error occur...
1
by: Bob N5 | last post by:
I am working on an application that uses interop to do some simple operations with both Excel and Word. I have most of functionality working, but ran into issues on making things work with both...
20
by: Razzie | last post by:
Hey all, I'm really going through a small hell right now - I've completely lost it :) I made a project, using two interop libraries from exchange (created them as in this msdn article:...
3
by: ScottWPNY | last post by:
I am including a reference to ADOX in a C# project by doing the following: In Solution Explorer, right-click the References node and select Add Reference. On the COM tab, select Microsoft ADO...
8
by: Rob Edwards | last post by:
When trying to add the Microsoft CDO for Exchange Management Library (aka CDOEXM.dll) I receive the following message: "A reference to 'Microsoft CDO for Exchange Management Library' could not be...
1
by: Tom | last post by:
Hi, I have developed a VB.NET app that is referencing and using an old ActiveX component. When I add that reference to .NET, it of course generates an interop file. My question is: If I include...
5
by: Richard Lewis Haggard | last post by:
I am trying to create multi-dimensioned arrays in conventional ASP pages and pass these arrays as arguments to functions that are in a C# interop assembly. ASP complains because it doesn't...
5
by: Yoavo | last post by:
Hi, In my application I have to use som external COM dll's. In the code: using MyDll when I build the project, I get (in addition to the .exe file) a Dll called Interop.MyDll.dll I want to...
0
by: Ferd Biffle | last post by:
I am trying to convert an Add-In I wrote from .Net 1.1 (32 bit) to 2.0 on 64 bit XP. One of the vendor API Interop dll's that I am referencing is unavailable to my add-in. Looking at the...
5
by: John | last post by:
I would like to ask a question that is obvious to all people porting applications from the "traditional" C\VB6 interop scheme choosing C# vs VB.NET. We have a math library in C which...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.