3

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?

Cor
  • 389
  • 1
  • 2
  • 14
Kevin
  • 5,626
  • 3
  • 28
  • 41
  • You might consider changing the title of your post to "Creating an IPortableDeviceManager in C#" - since that's really what you want to do. – Steve Jul 01 '11 at 21:45

1 Answers1

5

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();

Steve
  • 31,144
  • 19
  • 99
  • 122