Jedhi Posted July 14, 2004 Posted July 14, 2004 In C++ there is a function called SetupDiGetDeviceRegistryProperty, that retrieves the device property. But in C# I can not find this function. Could anybody help me to tell me what it is called in C# ? Quote
Jedhi Posted July 14, 2004 Author Posted July 14, 2004 I think that you must use P/Invoke... In C++ I can use this function to get the device properties. Frankly I am interested in getting the friendly name of the device (fname), so I know exactly which com ports exist. bool bSuccess = SetupDiGetDeviceRegistryProperty(hDevInfo, &devdata, SPDRP_FRIENDLYNAME, NULL, (PBYTE)fname, sizeof(fname), NULL); But I can not find anything that just look alike in C#. Any suggestion ?. Quote
Wile Posted July 14, 2004 Posted July 14, 2004 You might be able to retrieve the device information through the WMI support in .NET, but I don't know how this works. It looks like this http://www.thecodeproject.com/csharp/DivingSysProg3.asp does something close to what you want, you might want to check it out (they dont use WMI but use the win32api directly) Quote Nothing is as illusive as 'the last bug'.
Jedhi Posted July 14, 2004 Author Posted July 14, 2004 You might be able to retrieve the device information through the WMI support in .NET, but I don't know how this works. It looks like this http://www.thecodeproject.com/csharp/DivingSysProg3.asp does something close to what you want, you might want to check it out (they dont use WMI but use the win32api directly) Thanks alot Wile, just what I need. I just need to Import the setupapi dll to use the SetupDiGetDeviceRegistryProperty function. I just can not get why nothing alike exist in C#. If anybody reads this, and know how to do it in C# way, please let me know. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.