Click here to Skip to main content
Click here to Skip to main content

Implementing IShellBrowser to host IShellView

, 4 Jun 2001 CPOL
Rate this:
Please Sign up or sign in to vote.
Imitating the Windows Explorer
<!-- Article image -->

Sample Image - screen.gif

<!-- Main HTML starts here -->


I wondered how I can simulate the Windows explorer listview of files. Here is what I found. It might be useful to someone. If you create a simple listview control and populate it with files/folders, you'll notice that you can't:

  • Easily detect changes to files (rename, delete, copy/move...etc) while user is viewing the list
  • Send To menu is not populated if you try to use the shell's menu for your items
  • There doesn't seem to be a way of getting the column names used in shellview (filename, size, owner, times, and many others)

I found that Windows explorer and File Open dialog expose IShellBrowser, which is used by IShellFolder/IShellView to create the listview of files. So, I created a simple app with WTL. Implemented basic IShellBrowser methods and exposed it to IShellView through IShellFolder::CreateViewObject. Finally, to create the listview I called IShellView::CreateViewWindow. I didn't try to merge the menus.
Things I couldn't get to work:

  • Toolbar buttons (they were added to my toolbar, but bitmaps were messed up). They do function however.
  • The most important one for me was that I couldn't easily detect when user wanted to open/explore/search the selected folder so I could sync the file tree.

The IShellBrowser::BrowseObject was never even called, so I didn't implement it, but it should be implemented because most NSEs use this method. I did find that the shellview sends WM_DDE* messages and if you respond properly you'll get the info about the action user taken. The needed messages are WM_DDE_INITIATE, WM_DDE_EXECUTE, WM_DDE_TERMINATE. WM_DDE_EXECUTE will give you string such as
"[ViewFolder("C:\Documents and Settings\leon\Desktop\billing", :428:780, 1)]". I have no idea what the 428:780 stand for. But action would be ViewFolder/ExploreFolder/FindFolder. It would be nice if Microsoft documented this stuff then we could use it. But as things stand now they even say in the MSDN:

"You do not implement this interface directly. IShellBrowser is implemented by Windows Explorer and by the Windows File Open common dialog box."

But then why did they tell us about WM_GETISHELLBROWSER? Anyway, maybe it would be useful to someone, so here it is.

Some useful points:

  • To get drag drop functioning in shellview, call OleInitialize/OleUninitialize
  • Make sure you respond properly to WM_GETISHELLBROWSER or CreateView might crash
  • Details listview seems to work only with FVM_DETAILS and FWF_SNAPTOGRID combination
  • ICommDlgBrowser can be supported to have a simple listview like in common file dialog boxes (without webview)
  • Don't name your executable as explorer.exe or unpleasant things will happen

Useful links



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Leon Finker

United States United States
No Biography provided

Comments and Discussions

GeneralShowing only folders in tree PinmemberNethen31-Oct-10 0:49 
GeneralAwesome code! PinmemberT800G10-Oct-09 2:43 
QuestionContext Menu Problem PinmemberrImrose29-May-09 7:40 
QuestionHow can I embed the whole Explorer window in my window PinmemberJaved Akhtar Ansari3-Oct-08 1:55 
GeneralrIt wasn't worked Pinmemberjalalymm15-Apr-07 2:56 
QuestionHow to get thumbnail from windown Explorer? Pinmemberthanhthuyvn_vtajkhskjakjd16-Oct-06 23:13 
Generalerror Pinmemberkiranin10-Sep-06 22:21 
QuestionIs there any solution to implement this project on a dailog-based application? PinmemberAki Wang19-Jul-06 16:28 
GeneralNever ending dialog pops up PinmemberR.D.H.2-May-06 7:24 
QuestionHow to get the path for each icon in the Desktop folder Pinmembergiftsana22-Mar-06 16:27 
AnswerRe: How to get the path for each icon in the Desktop folder Pinmembergiftsana27-Mar-06 20:18 
GeneralSetting the path Pinmembercowtongue215-Feb-06 18:06 
Questionwhy cannot use &quot;delete&quot; key to delete file? Pinmembertianzuo3-Nov-05 22:36 
GeneralStatus bar messages and Multi Thread PinmemberGuybrush19-Mar-05 12:55 
GeneralWM_DDE* messages seems are not sent Pinmemberalerma19-Oct-04 10:15 
GeneralRe: WM_DDE* messages seems are not sent PinmemberRickyV19-Oct-04 15:09 
GeneralRe: WM_DDE* messages seems are not sent Pinmemberalerma20-Oct-04 2:35 
GeneralRe: WM_DDE* messages seems are not sent PinmemberRickyV20-Oct-04 15:12 
GeneralRe: WM_DDE* messages seems are not sent PinmemberLeon Finker20-Oct-04 15:40 
GeneralDetecting cut/paste operations Pinsussorangerobin1-Oct-04 3:41 
Generalusing the same ishellview PinmemberRickyV20-Sep-04 22:27 
GeneralRe: using the same ishellview PinmemberLeon Finker21-Sep-04 14:55 
GeneralRe: using the same ishellview PinmemberRickyV21-Sep-04 16:03 
GeneralBrowseObject Pinmemberquinthar13-Nov-04 23:21 
GeneralRe: BrowseObject PinmemberRickyV28-Nov-04 21:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411023.1 | Last Updated 5 Jun 2001
Article Copyright 2001 by Leon Finker
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid