-
November 14th, 2005, 12:46 PM
#1
SHBrowseForFolder with BIF_NEWDIA******** problem
I'm using SHBrowseForFolder to allow the user to pick a folder and I want to use the new dialog style (BIF_NEWDIA********). When I add this flag, the status text of the dialog will not display. If I don't use this flag, it displays correctly. Is there something I need to do in addition to adding this flag?
-
November 14th, 2005, 03:26 PM
#2
Re: SHBrowseForFolder with BIF_NEWDIA******** problem
Originally Posted by SkidMark75
I'm using SHBrowseForFolder to allow the user to pick a folder and I want to use the new dialog style (BIF_NEWDIA********). When I add this flag, the status text of the dialog will not display. If I don't use this flag, it displays correctly. Is there something I need to do in addition to adding this flag?
according to MSDN you need to call ::OleInitialize(..) or CoInitialize(...) if you use this flag.
Originally Posted by MSDN
To use this flag, you must call OleInitialize or CoInitialize before calling SHBrowseForFolder.
did you do it?
Cheers
-
November 14th, 2005, 03:42 PM
#3
Re: SHBrowseForFolder with BIF_NEWDIA******** problem
Yes, I am calling CoInitialize() prior to calling SHBrowseForFolder(). I just noticed in MSDN that the BIF_STATUSTEXT flag is not supported when BIF_NEWDIA******** is specified.
http://msdn.microsoft.com/library/de...browseinfo.asp
Does this mean that setting the status text is not supported or that the flag is just ignored? That probably sounds like a stupid question, but I'm not thinking too clearly after banging my head into the wall for the past few hours.
-
November 14th, 2005, 04:27 PM
#4
Re: SHBrowseForFolder with BIF_NEWDIA******** problem
I solved my problem somewhat...
I added the FindWindowEx and following SendMessage functions:
Code:
int CALLBACK BrowseCallbackProc (HWND hWnd, UINT msg,
LPARAM lParam, LPARAM lpData)
{
LPCTSTR pszRootDir = (LPCTSTR)lpData;
switch(msg)
{
case BFFM_INITIALIZED:
{
SendMessage(hWnd,BFFM_SETSELECTION,TRUE,(LPARAM)pszRootDir);
HWND hEdit = FindWindowEx(hWnd, NULL, "Edit", NULL);
if(hEdit)
{
SendMessage(hEdit, WM_SETTEXT, 0, (LPARAM)pszRootDir);
}
break;
}
case BFFM_SELCHANGED:
{
TCHAR szDir[MAX_PATH];
if( SHGetPathFromIDList((LPITEMIDLIST)lParam, szDir))
{
// SendMessage(hWnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir);
HWND hEdit = FindWindowEx(hWnd, NULL, "Edit", NULL);
if(hEdit)
{
SendMessage(hEdit, WM_SETTEXT, 0, (LPARAM)szDir);
}
}
break;
}
}
return 0;
}
Last edited by SkidMark75; November 14th, 2005 at 04:37 PM.
Reason: attachment
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|