Question

We need to host explorer-like browser window in our application. We cann't use new IExplorerBrowser because of need to keep compatibility with Windows XP.

The main problem is we need to show items in "Large Icons" mode by default. Unfortunately, calling IShellVIew.CreateViewWindow() with FOLDERSETTINGS.viewMode = 0x1 /* LargeIcon */ doesn't change view mode to desired. But I can do this manually by context menu in the window.

So we need to set "Large Icons" view mode. I didn't found any way to programmatically get context menu for the view itself.

Then, I've found that IShellView2 seems has needed way to go - IShellView2.CreateViewWindow2() that receives view mode as GUID rather than predefined const. But cann't get access to the interface!

IShellFolder.CreateViewObject(hwndOwner, typeof(IShellView).GUID) returns correct instance. But when I try IShellFolder.CreateViewObject(hwndOwner, typeof(IShellView2).GUID) I've got exception "Specified cast is not valid".

How can I obtain object for IShellView2 interface???

Was it helpful?

Solution

Call the QueryInterface method on the IShellView object to ask it for IID_IShellView2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top