Windows Vista 64 bit + File System redirection + SHBrowseForFolder

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hello
i am tring to use this code for broser for folder dialog. for some reaons i need to disable file system redirection. but when i call this code after disabling the file redirection. then browse dialog shows nothing in it.. looks like a bug.. i
am trying it on Vista 64 bit machine. is there any way to solve it.
<div style="color:Black;background-color:White; <pre>
<span style="color:Green; // Prompt the user for a folder to scan
BROWSEINFO bi;
<span style="color:Blue; wchar_t szDir[MAX_PATH] = { 0 };
LPITEMIDLIST pidl;
LPMALLOC pMalloc;

<span style="color:Blue; if ( SUCCEEDED(SHGetMalloc( &pMalloc )) )
{
<span style="color:Green; //we need to disable folder redirection.
<span style="color:Green; //as in the browse dialog if user selects system32 it is a view of SYSWOW64 folder NOT
<span style="color:Green; //the actual 64 bit
C64bitRedirection Disable(IsWow64());

std::wstring sTitle( L<span style="color:#A31515; "deepak" );
ZeroMemory(&bi,<span style="color:Blue; sizeof(bi));
bi.hwndOwner = NULL;
bi.pszDisplayName = 0;
bi.pidlRoot = 0;
bi.lpszTitle = sTitle.c_str();
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_USENEWUI | BIF_NONEWFOLDERBUTTON;
bi.lpfn = NULL;

pidl = SHBrowseForFolder( &bi );
<span style="color:Blue; if ( pidl != NULL )
{
SHGetPathFromIDList( pidl, szDir );
pMalloc->Free( pidl );
}
pMalloc->Release();

<span style="color:Green; // Did we get a folder?
<span style="color:Blue; if ( szDir[0] == 0 )
<span style="color:Blue; return 0;

MessageBox(NULL,szDir,L<span style="color:#A31515; "",1 );
<span style="color:Green; //sFileOrDir = szDir;

}
[/code]




View the full article
 
Back
Top