How do I create an instance of IPortableDeviceManager?
I'm trying to create an instance of the IPortableDeviceManager
class with the method CoCreateInstance(..)
but I cannot find the CLSID
a.k.a GUID
of the class.
I dived in to the Windows SDK in an attempt to find the 开发者_运维问答GUID
but the only thing I could find was the following line in the file PortableDeviceApi.h
:
EXTERN_C const CLSID CLSID_PortableDeviceManager;
That didn't really help me out either..
So, what am I doing wrong? Is there any way I can find out the GUID
of IPortableDeviceManager
? Or instantiate an instance of it?
http://msdn.microsoft.com/en-us/library/dd319331%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/dd388688%28v=vs.85%29.aspx
Have you seen this article: http://blogs.msdn.com/b/wpdblog/archive/2007/11/26/creating-a-temperature-sensor-gadget-for-windows-sidebar.aspx
Called "Creating a Temperature-Sensor Gadget for Windows Sidebar with C#"... and it references this article:
http://blogs.msdn.com/b/dimeby8/archive/2006/12/05/enumerating-wpd-devices-in-c.aspx
Called "Enumerating WPD devices in C#"... which references this article (LOL):
http://blogs.msdn.com/b/dimeby8/archive/2006/12/05/c-and-the-wpd-api.aspx
Summarizing:
Step 1:
To start, create a new C# Console Application project. Next select the "Project>Add Reference ..." menu option. Click the "COM" tab in the "Add Reference" dialog and make sure the following items are selected and then click OK:
PortableDeviceApi 1.0 Type Library
PortableDeviceTypes 1.0 Type Library
Step 2:
PortableDeviceApiLib.PortableDeviceManagerClass devMgr = new PortableDeviceApiLib.PortableDeviceManagerClass();
精彩评论