 |
|
 |
The following code can be used to only show browsable folder locations. It removes "Control Panel". The reason for the GetFileAttributes is if you have large zip files on your desktop, then the tree takes a long time to load due to the call to pParentFolder->GetAttributesOf.
bool CMainFrame::Tree_EnumObjects(HTREEITEM hParentItem,IShellFolder* pParentFolder, ITEMIDLIST* pidlParent)
{
IEnumIDList* pEnum;
WCHAR lpwszDisplayName[4096];
if(SUCCEEDED(pParentFolder->EnumObjects(NULL, SHCONTF_FOLDERS|SHCONTF_INCLUDEHIDDEN, &pEnum)))
{
ITEMIDLIST* pidl;
DWORD dwFetched = 1;
DWORD dwAttribs;
TV_ITEM tvItem={0};
TV_INSERTSTRUCT tvInsert={0};
while (SUCCEEDED(pEnum->Next(1, &pidl, &dwFetched)) && dwFetched)
{
dwFetched = 0;
SHGetPathFromIDListW(pidl, lpwszDisplayName);
dwAttribs = GetFileAttributesW(lpwszDisplayName);
if ((*lpwszDisplayName != 0) && ((dwAttribs & FILE_ATTRIBUTE_DIRECTORY) == 0))
continue;
dwAttribs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER |SFGAO_COMPRESSED| SFGAO_STREAM | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_DISPLAYATTRMASK | SFGAO_CANRENAME;
pParentFolder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidl, &dwAttribs);
if (((dwAttribs & SFGAO_FOLDER) == 0) || ((dwAttribs & SFGAO_STREAM) != 0) || ((dwAttribs & SFGAO_COMPRESSED) != 0))
continue;
if (((dwAttribs & SFGAO_FILESYSTEM) == 0) && ((dwAttribs & SFGAO_FILESYSANCESTOR) == 0))
continue;
TREEITEMINFO* pItemInfo = new TREEITEMINFO;
pItemInfo->pidlSelf = pidl;
pItemInfo->pidlFullyQual = Pidl_Concatenate(pidlParent,pidl);
pParentFolder->AddRef();
pItemInfo->pParentFolder = pParentFolder;
ZeroMemory(&tvItem, sizeof(tvItem));
tvItem.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN;
tvItem.pszText = LPSTR_TEXTCALLBACK;
tvItem.iImage = tvItem.iSelectedImage = I_IMAGECALLBACK;
tvItem.lParam= (LPARAM)pItemInfo;
tvItem.cChildren = (dwAttribs & SFGAO_HASSUBFOLDER);
if(dwAttribs & SFGAO_SHARE)
{
tvItem.mask |= TVIF_STATE;
tvItem.stateMask |= TVIS_OVERLAYMASK;
tvItem.state |= INDEXTOOVERLAYMASK(1);
}
tvInsert.item = tvItem;
tvInsert.hInsertAfter = TVI_LAST;
tvInsert.hParent = hParentItem;
m_FileTreeBox.InsertItem(&tvInsert);
dwFetched = 0;
}
pEnum->Release();
return true;
}
return false;
}
|
|
|
|
 |
|
 |
Great code sample!
It makes debugging shell extensions easy and trouble-free.
|
|
|
|
 |
|
 |
I would like to remove “Open”, “Explorer”, “Search”, “Properties” from IShellView (Right Panel) Context Menu. How do I do that?
Is there any way to modify menu before showing right click context menu (Right Side Panel). Is that menu generating from IShallView or IShellFolder?
Please help me.
Regards,
Imrose
|
|
|
|
 |
|
 |
Is it possible to embed the whole explorer window in a dialog or a window?
Javed A Ansari
Software Developer
Hyderabad, India
|
|
|
|
 |
|
 |
Dear Sir,
Please see the message below:
fatal error RC1015: cannot open include file 'atlres.h'
Regards
Monther
Monther
|
|
|
|
 |
|
 |
I want to get thumbnail from windown Explorer. Can you help me.
Thanks
jkljj
|
|
|
|
 |
|
 |
fatal error RC1015: cannot open include file 'atlres.h'
|
|
|
|
 |
|
 |
Hi,
Is there any solution to implement this project on a dailog-based application?
Thank you very much!
|
|
|
|
 |
|
 |
I downloaded the sample and built the project. While testing I browsed to a folder that contained the "My web sites on MSN" subfolder. Big mistake. Every few seconds a "Connect to www.msnusers.com" dialog pops up. I can dismiss it but it comes back. If I dismiss it and I can quickly click on the tree control to go to another directory. However the dialg continues to pop up for an extended period of time. I have also seen a dialog that asks me to get a Microsoft Passport when this is happening.
I do not see this behaviour with Explorer. What modifications are necessary to get this implemenation to do the same thing Explorer does. This only seems to happen when in thumbnail mode.
|
|
|
|
 |
|
 |
Hi Leon
I want to get the path for each icon/folder inside the desktop folder from your application.
How do i go about doing it?
I need to log the name of each folder inside the desktop folder and it's path.
How do i get the path for each folder? Am stuck here.
A reply soonest will be appreciated.
Sincerely
Giftsana
|
|
|
|
 |
|
 |
I got the solution using SHGetPathFromIDList with corresponding pidl.
Giftsana
|
|
|
|
 |
|
 |
I'm having a hard time setting the path manually. I can't grasp the basic concepts enough to implement BrowseObject(). I think I'd have to walk the tree or something, but I'm a noob. Has anybody implemented BrowseObject()? Or has anybody got some other way of manually setting the path?
Thanks
|
|
|
|
 |
|
 |
I found that it won't handle any accelator keys, such as "delete", "ctrl+c", "ctrl+v", "f2", who can help me ?
|
|
|
|
 |
|
 |
Hi Leon, and thanks for the example, very usefull!
I am implementig IShellBrowser in a separate class/view, passing to the main form the handle of the ListView created by CreateViewWindow, but a part of this, the rest of the code follow pretty much your example.
It seems to work, however I noticed that there is a problem concerning the messages sent to the status bar.
If I implement this view in a multi-threaded sdi app, the status bar will not receive any message at all. I mean, if I set an initial message in the main app, then create the view and click on any icon, the status bar will go blank, erasing the message, but not display any file information at all.
What am I doing wrong, anyone?
Thanks to all, and keep up the excellent work!
|
|
|
|
 |
|
 |
Hi,
I tried to play with Spy++ on shellview to see WM_DDE* messages. It seems thay are not sent at all. Any suggestions?
Thanks
|
|
|
|
 |
|
 |
if you right click on any folder, then select "search" then your Spy++ will be able to detect the WM_DDE*. You can also use DDE Spy to spy on DDE* messages
|
|
|
|
 |
|
|
 |
|
 |
I am facing the same problem as you do. I am still looking for solution to this problem. From my understanding, the only time any WM_DDE_* is sent is when 2 programs need to exchange data. For example, when you double click on a folder in ishellview, a WM_DDE_INITIATE will be send to Windows Explorer(W.E). the W.E will open up the folder and display it.
|
|
|
|
 |
|
 |
Try running the sample code. Use spy++ on main frame window. You'll see WM_DDE* messages. Just follow the same format that MS uses in the webapp sample.
|
|
|
|
 |
|
 |
Hi,
How can I detect cut/paste operations ocurring in the IShellView?
Thanks!
|
|
|
|
 |
|
 |
Hi Sir,
I am wondering what i will have to modify if i want to use the same ishellview to display the contents of the folder when i double click it on the ishellview(just like when you double click in the folder in windows explorer).
Thank You
|
|
|
|
 |
|
 |
Hi,
You can handle DDE messages as in this example:
http://support.microsoft.com/support/kb/articles/q189/6/34.asp
http://www.codeguru.com/Cpp/COM-Tech/shell/comments.php/c4521/?thread=52742
|
|
|
|
 |
|
|
 |
|
 |
Alternatively, it looks like IShellBrowser::BrowseObject( ) is called when you double-click on a folder. However, it won't call it normally. Instead I needed to extend my IShellBrowser object to also have the IServiceProvider interface, and then return an IShellBrowser interface when requested.
When you double-click on a folder, it looks like the IShellView first calls IServiceProvier::QueryService( ) for an IShellBrowser interface, and if it finds it it invokes IShellBrowser::BrowseObject( ) with the PIDL of the new folder and does nothing (ie, waits for you to open the new folder). If you don't implement IServiceProvider (or don't return an IShellBrowser from QueryService), it looks like IShellView just launches a whole new Windows Explorer to display the new folder.
I haven't implemented same-window navigation yet, but I expect to just create a new IShellView using the PIDL supplied in BrowseObject, and then swap the child's new window with the parent folder's IShellView window. I could even keep around the old IShellView to speed up the "Back" function, or destroy and recreate it later. We'll see.
-david
|
|
|
|
 |
|
 |
Hey David, Thanks alot. Finally i get to work now.
RickyV
|
|
|
|
 |