DirectUIHWND
(1)
Windows 7
(1)
XP
(1)
STopLevelBrowser
(1)
IWebBrowserApp
(1)
ControlNotifySink
(1)
CoCreateInstance
(1)
IServiceProvider
(1)

How to get the right hand pane ( DirectUIHWND ) in Windows 7

Asked By Sujay Ghosh
16-Nov-09 12:56 PM
Hello ,

I can access the right pane of the Windows Explorer in XP ( 32 bit ) , by
getting the handle to the "SysListView32" .

But in Windows 7 , the window class for the right hand side of the Windows
Explorer is DirectUIHWND. I have used Spy++ to see the child windows, but I
only find ControlNotifySink .

Any idea how do I get the list view .

Thanks in advance

Sujay

--
Sujay Ghosh

MSN : sujayghosh@hotmail.com

Sujay Ghosh wrote:There is not one any more.

Jim Barry replied to Sujay Ghosh
17-Nov-09 10:02 AM
There is not one any more. It seems that Microsoft has reimplemented
DefView using DirectUI (the undocumented user interface engine used by
the Common Tasks pane in XP, amongst other things).

- Jim

Hello Jim,Thanks for sharing the info .

Sujay Ghosh replied to Jim Barry
17-Nov-09 02:26 PM
Hello Jim,

Thanks for sharing the info .

But I think one can access the DirectUIHWND internals , and find  the list
view from their. I am doing some R&D , and shall post once I get over it .

I see a light .. not enough to brighten up the tunnel now ..:-)

Sujay

How to get the right hand pane ( DirectUIHWND ) in Windows 7

Nathalie D'Amours replied to Sujay Ghosh
12-May-10 10:52 PM
Hi Sujay,



It is likely too late for you but the solution I found might help somebody else. The following code allows you to make Windows Explorer on Windows 7 use the good old SysListView32 control rather than DirectUIHWND. This fixed my compatibility problem. In a nutshell, it uses the new Windows 7 interface IFolderViewOptions to enable the option FVO_VISTALAYOUT. You need to compile with version 7.0 of the SDK to do this.



void RevertExplorerToListView(

HWND explorerHandle)

{

IShellWindows *shellWindow;

if (SUCCEEDED(CoCreateInstance(CLSID_ShellWindows,

NULL,

CLSCTX_ALL,

IID_IShellWindows,

reinterpret_cast<void**>(&shellWindow))))

{

VARIANT v;

V_VT(&v) = VT_I4;

IDispatch  *dispatch;

BOOL found = FALSE;



for (V_I4(&v) = 0 ; !found && shellWindow->Item(v, &dispatch) == S_OK ;

V_I4(&v)++)

{

IWebBrowserApp *browserApp;

if (SUCCEEDED(dispatch->QueryInterface(IID_IWebBrowserApp,

reinterpret_cast<void**>(&browserApp))))

{

HWND appHandle;

if (SUCCEEDED(browserApp->get_HWND(reinterpret_cast<LONG_PTR*>(&appHandle))) &&

appHandle == explorerHandle)

{

found = TRUE;

IServiceProvider *provider;

if (SUCCEEDED(browserApp->QueryInterface(IID_IServiceProvider,

reinterpret_cast<void**>(&provider))))

{

IShellBrowser *browser;

if (SUCCEEDED(provider->QueryService(SID_STopLevelBrowser,

IID_IShellBrowser,

reinterpret_cast<void**>(&browser))))

{

IFolderViewOptions *options;

if (SUCCEEDED(browser->QueryInterface(IID_IFolderViewOptions,

reinterpret_cast<void**>(&options))))

{

if (FAILED(options->SetFolderViewOptions(FVO_VISTALAYOUT,

FVO_VISTALAYOUT)))

{

TRACE("SetFolderViewOptions failed");

}

options->Release();

}

browser->Release();

}

provider->Release();

}

}

browserApp->Release();

}

}

shellWindow->Release();

}

}





Nathalie
Post Question To EggHeadCafe