November 18th, 2008, 02:26 AM
Using GetDevice function of IPortableDeviceManager interface...
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
November 18th, 2008, 08:01 AM
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:
//assume p is instantiated and points to the proper interface.
//count should be number of devices (maybe do sanity check).
devlist=new wchar_t *[count];
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!