Board index » cppbuilder » SHBrowseForFolder Function and highlighting text in the dialog's EDIT box

SHBrowseForFolder Function and highlighting text in the dialog's EDIT box


2008-02-02 06:43:13 AM
cppbuilder68
When using SHBrowseForFolder Function with a callback function - I have the
BROWSEINFO Structure flags BIF_VALIDATE and BIF_EDITBOX set.
Now when an invalid folder is entered by the user in the EDIT box and the
call back function uMsg BFFM_VALIDATEFAILED is enacted - Is it possible
after the error message is closed to highlight the incorrect folder name in
the EDIT box in the Browse for Folder dialog? or perhaps remove it and
refocus onto a folder in the dialog's folder tree?
thanks
daryl
 
 

Re:SHBrowseForFolder Function and highlighting text in the dialog's EDIT box

"Daryl" < XXXX@XXXXX.COM >wrote in message
Quote
Is it possible after the error message is closed to highlight
the incorrect folder name in the EDIT box in the Browse
for Folder dialog?
Not directly. You would have to manually find the HWND of the edit field
and then pass it to SetFocus().
Quote
or perhaps remove it and refocus onto a folder in the dialog's
folder tree?
Send a BFFM_SETSELECTION message to the HWND provided by the callback,
specifying a valid path.
Gambit
 

Re:SHBrowseForFolder Function and highlighting text in the dialog's EDIT box

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Daryl" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>Is it possible after the error message is closed to highlight
>the incorrect folder name in the EDIT box in the Browse
>for Folder dialog?

Not directly. You would have to manually find the HWND of the edit field
and then pass it to SetFocus().
How could I go about manually find the HWND of the edit field?
thanks
daryl
 

{smallsort}

Re:SHBrowseForFolder Function and highlighting text in the dialog's EDIT box

Quote
>>Is it possible after the error message is closed to highlight
>>the incorrect folder name in the EDIT box in the Browse
>>for Folder dialog?
>
>Not directly. You would have to manually find the HWND of the edit field
>and then pass it to SetFocus().

How could I go about manually find the HWND of the edit field?
I tried this:
HWND hwndEdit = FindWindowEx(hwnd, NULL, "Edit", NULL); // hwnd is the
handle to the dialog.
SendMessage(hwndEdit, WM_SETTEXT, 0, (long)"");
This seems to work, does it look OK?
I would like to know how to highlight the text in the EDIT box, instead of
deleting it - can you assist?
thanks
daryl
 

Re:SHBrowseForFolder Function and highlighting text in the dialog's EDIT box

"Daryl" < XXXX@XXXXX.COM >wrote in message
Quote
I would like to know how to highlight the text in the EDIT box, instead of
deleting it - can you assist?
See EM_SETSEL.
- Dennis