I was just working with WIN32 apis and I thought that when we use the browse for folder dialog boxes, at that time there is nothing that shows us the full path and so, I have written this program.
How It Works?
This code is fully based on the win32 apis. I am giving this functionality using the basic functions; let us discuss them one by one...
This program uses the simple win32 api function calls like ,
CreateWindow etc. With these functions we can create the edit box and the static control. The
CreateWindowEx function is used to create the child controls that are one edit box and the one static control. Then just add it to the Browse for folder dialog.
Firstly Declare the lpofn to the
BorwseCallbackProc Procedure. Then the whenever the browse for folder dialog box initializes that time it will send the message to the procedure that is "
BFFM_INITIALIZED". That time create the edit and the static controls like below...
edit=CreateWindowEx(0,"EDIT","Yogesh M Joshi.",WS_CHILD|WS_VISIBLE|WS_BORDER|
HWND caption=CreateWindowEx(0,"STATIC","You have selected the folder :",
ghInstance is the instance of the dialog box. The "EDIT" and "STATIC" are the names of the classes. and The flags sets the style of the contols. Just then we will have to resize the list view contol but firstly we will find it on the "Browse For Folder" dialog, That's so easy just use the
In this way we have find the handle of the List iew then resize it. Use the
GetWindowRect function to get the rectangles of the "Browse For Folder" Dialog. This will take place in the following way...
And then I have used the
SetFont function to set the fonts of the static and edit control.
void SetFont(HWND hwnd,LPTSTR FontName,int FontSize)
lf.lfWeight = FW_REGULAR;
lf.lfHeight = (LONG)FontSize;
lstrcpy( lf.lfFaceName, FontName );
In this way we have resized the contols. But main thing is not over that if we select any folder then the edit contol must show it. For this purpose the callback message "
BFFM_SELCHANGED" and use the
SetWindowText api to set the text of the edit contol.
t = SHGetPathFromIDList((ITEMIDLIST*)lParam, c);
That's all and in this way we can customize the "Browse For Folder" dialog box.
Use this code for educational purpose only. Mail your comments at : email@example.com and to pick some COOL windows utilities isit my homepage at http://www.stechome.netfirms.com/ I am waiting to hear from you.