Browseforfolder callback: global variable?
Posted on 2005-03-28
I would like to have some customizable things in my programms.
I specifically would like to set a selected path in a BrowseForFolder dialog.
I found a callback function on EE that would take care of that:
int CALLBACK BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM lp, LPARAM pData)
if (GetCurrentDirectory(sizeof(szDir)/sizeof(TCHAR), szDir))
//Hardwirering the path in the sendmessage here.
//Want that to be a variable.
SendMessage(hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)_T("c:\\"));
if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir))
1.However, I need to specify the path in SendMessage(,,,LPARAM(PATH)).
I would like to use a variable to do that.
2. The Callback function is global, right?
Where in a project would I put it if I have multiple Dialogs that would call that function?
3. Where to put the global variable (if needed).
4. Is there a better way to do it?
BTW pidlRoot should stay NULL since I want the user to be able to change the selection
to whatever diretory he chooses on his computer.