+
+ return wxID_OK;
+}
+
+// ----------------------------------------------------------------------------
+// private functions
+// ----------------------------------------------------------------------------
+
+static int CALLBACK
+BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
+{
+ switch(uMsg)
+ {
+ case BFFM_INITIALIZED:
+ // sent immediately after initialisation and so we may set the
+ // initial selection here
+ //
+ // wParam = TRUE => lParam is a string and not a PIDL
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData);
+ break;
+
+ case BFFM_SELCHANGED:
+ {
+ // Set the status window to the currently selected path.
+ TCHAR szDir[MAX_PATH];
+ if ( SHGetPathFromIDList((LPITEMIDLIST)lp, szDir) )
+ {
+ SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir);
+ }
+ }
+ break;
+
+ //case BFFM_VALIDATEFAILED: -- might be used to provide custom message
+ // if the user types in invalid dir name
+ }
+
+ return 0;
+}
+
+
+static void ItemListFree(LPITEMIDLIST pidl)
+{
+ if ( pidl )
+ {
+ LPMALLOC pMalloc;
+ SHGetMalloc(&pMalloc);
+ if ( pMalloc )
+ {
+ pMalloc->Free(pidl);
+ pMalloc->Release();
+ }
+ else
+ {
+ wxLogLastError("SHGetMalloc");
+ }
+ }