Using GetDevice function of IPortableDeviceManager interface...
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Using GetDevice function of IPortableDeviceManager interface...

  1. #1
    Join Date
    Feb 2007

    Using GetDevice function of IPortableDeviceManager interface...

    Hi all,

    I want to open a connection with portable device connected to my pc for this i am using COM and a interface called IPortableDeviceManager.

    To get devices i am using GetDevice function from this interface but i am
    not getting how to pass parameters to this function

    Can anybody please help me in this...

    Thanks in advance

  2. #2
    Join Date
    Feb 2005

    Re: Using GetDevice function of IPortableDeviceManager interface...

    I've never used this interface before, but it seems similar to other COM routines that return a list. As the documentation says, call it first with NULL to determine how many items exist, the allocate memory for the list, then call it again with your list. If I'm reading the docs correctly the list is an array of wide string pointers. The caller need only allocate the list of pointers. The function allocates memory for each string in the list and assigns them to your pointer list. Later, the caller is responsible for freeing the memory for each string. The code flow should be something like this:

    int doit()
      DWORD count=0;
      HRESULT hr;
      wchar_t **devlist;
      IPortableDeviceManager *p;
      //assume p is instantiated and points to the proper interface. 
      //check hr
      //count should be number of devices (maybe do sanity check).
      devlist=new wchar_t *[count]; 
      for(int i=0;i<count;i++){
      for(int i=0;i<count;i++){
      delete[] devlist;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center