aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-08-10 19:24:24 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-08-10 20:27:48 -0500
commit3756ae7c8dc60d459511d0b067ebef5efb052746 (patch)
tree5aa0505d3ab4e4337575597bcad9c6fd641ea78d /src/tools
parent84e7b6d277e5c3d118e11a45834d420254a758c0 (diff)
downloadwix-3756ae7c8dc60d459511d0b067ebef5efb052746.tar.gz
wix-3756ae7c8dc60d459511d0b067ebef5efb052746.tar.bz2
wix-3756ae7c8dc60d459511d0b067ebef5efb052746.zip
Use IFileOpenDialog instead of SHBrowseForFolder and GetOpenFileName.
It is the recommended option since Vista and has better long path support.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/thmviewer/thmviewer.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/tools/thmviewer/thmviewer.cpp b/src/tools/thmviewer/thmviewer.cpp
index 38f3c4dc..4230dd35 100644
--- a/src/tools/thmviewer/thmviewer.cpp
+++ b/src/tools/thmviewer/thmviewer.cpp
@@ -66,6 +66,13 @@ static void CALLBACK ThmviewerTraceError(
66 __in va_list args 66 __in va_list args
67 ); 67 );
68 68
69static COMDLG_FILTERSPEC vrgFilters[] =
70{
71 { L"Theme Files (*.thm)", L"*.thm" },
72 { L"XML Files (*.xml)", L"*.xml" },
73 { L"All Files (*.*)", L"*.*" },
74};
75
69 76
70int WINAPI wWinMain( 77int WINAPI wWinMain(
71 __in HINSTANCE hInstance, 78 __in HINSTANCE hInstance,
@@ -110,24 +117,8 @@ int WINAPI wWinMain(
110 if (!sczThemeFile) 117 if (!sczThemeFile)
111 { 118 {
112 // Prompt for a path to the theme file. 119 // Prompt for a path to the theme file.
113 OPENFILENAMEW ofn = { }; 120 hr = WnduShowOpenFileDialog(hWnd, TRUE, TRUE, vpTheme->sczCaption, vrgFilters, countof(vrgFilters), 1, NULL, &sczThemeFile);
114 WCHAR wzFile[MAX_PATH] = { }; 121 if (FAILED(hr))
115
116 ofn.lStructSize = sizeof(ofn);
117 ofn.hwndOwner = hWnd;
118 ofn.lpstrFile = wzFile;
119 ofn.nMaxFile = countof(wzFile);
120 ofn.lpstrFilter = L"Theme Files (*.thm)\0*.thm\0XML Files (*.xml)\0*.xml\0All Files (*.*)\0*.*\0";
121 ofn.nFilterIndex = 1;
122 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
123 ofn.lpstrTitle = vpTheme->sczCaption;
124
125 if (::GetOpenFileNameW(&ofn))
126 {
127 hr = StrAllocString(&sczThemeFile, wzFile, 0);
128 ExitOnFailure(hr, "Failed to copy opened file to theme file.");
129 }
130 else
131 { 122 {
132 ::MessageBoxW(hWnd, L"Must specify a path to theme file.", vpTheme->sczCaption, MB_OK | MB_ICONERROR); 123 ::MessageBoxW(hWnd, L"Must specify a path to theme file.", vpTheme->sczCaption, MB_OK | MB_ICONERROR);
133 ExitFunction1(hr = E_INVALIDARG); 124 ExitFunction1(hr = E_INVALIDARG);