Click to See Complete Forum and Search --> : Please Help! ItemIDLists
Hardeep Singh
April 9th, 1999, 09:44 AM
I'm posting a query on ItemIDLists for the third time...
Isn't there anyone who can show me a few lines of code on using an ItemIDList and accessing the folder it represents? The VC++ help on this topic is pretty vague, and I've just been trying to get these things to work but with no success.
I can't even seem to get something as straightforward as the file system directory of the recycle bin using the getpathfromidlist() function... I just can't figure out why that didn't work. So maybe I'm missing something... Please let me know soon.
Thanks.
jteagle@home
April 11th, 1999, 07:57 AM
I am 99% certain, assuming getpathfromidlist() is the same as WIN32's ShGetPathFromIDList(), that this ONLY returns a path from a PIDL if the PIDL represents a path in the normal filing system. The recycle bin is not in the normal filing system, it is a special folder - so you must use the equivalent of ShGetSpecialFolderLocation() to retrieve it. Does this help?
_ _
o o Jason Teagle
<
v jteagle@geocities.com
Hardeep Singh
April 12th, 1999, 05:12 AM
Can you at least tell me how to use the shell interfaces and their functions which will help me access shell objects? If you can I'll be very grateful
-Hardeep
jteagle@home
April 12th, 1999, 01:13 PM
Well, I'm afraid I don't know that much myself. All I know is that this snippet:
---
char cBuffer[_MAX_PATH];
CString strDirectory ;
if (SHGetPathFromIDList(lpsList,(LPSTR)cBuffer) )
strDirectory = cBuffer ;
---
will put the path into strDirectory if lpsList (an LPITEMIDLIST, which represents a folder) points to something in the normal file system.
This code snippet will get an LPITEMIDLIST for one of the special folders:
---
CWnd *pWndMain ;
LPITEMIDLIST *plpsList ;
pWndMain = AfxGetMainWnd();
if (pWndMain != NULL)
{
ShGetSpecialFolderLocation(pWndMain->m_hWnd, CSIDL_BITBUCKET, plpsList);
}
---
The above code gets an identifier of the recycle bin; use one of the other CSIDL_ constants given in the help for the function for the other folders. You would then use the resulting ID for other shell functions. Where a pointer to an ID is required, simply use "plpsList"; where an ID is required itself, use "*plpsList".
ShAddToRecentDocs() adds a file or special item to the Start menu's Documents menu; the first parameter is SHARD_PATH if the second parameter points to a string describing a normal filespec (e.g. "C:\My Work\SomeFile.txt"), or is SHARD_PIDL if the second parameter points to an ID (plpsList from above, for example, to add the recycle bin to the recent docs list - whether this is possible or not, I don't know).
There are many other Sh...() functions, a lot of which I don't understand. I can't really give you any more information than the help file can, but if you want to, write to jteagle@geocities.com telling me what you want to do and I'll see if I can give you the code to do it; if not, then you will have to resort to this message board again.
_ _
o o Jason Teagle
<
v jteagle@geocities.com
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.