SHBrowseForFolder
ユーザーに好意を示し、少なくともBIF_NEWDIALOGSTYLEフラグを設定してください。
初期フォルダーを設定するには、次のコードを追加します。
static int CALLBACK BrowseFolderCallback(
HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
if (uMsg == BFFM_INITIALIZED) {
LPCTSTR path = reinterpret_cast<LPCTSTR>(lpData);
::SendMessage(hwnd, BFFM_SETSELECTION, true, (LPARAM) path);
}
return 0;
}
// ...
BROWSEINFO binf = { 0 };
...
binf.lParam = reinterpret_cast<LPARAM>(initial_path_as_lpctstr);
binf.lpfn = BrowseFolderCallback;
...
適切なパスを提供します (最後の選択、アプリケーション データ フォルダーなどを記憶するなど)。