Created
July 20, 2016 08:27
-
-
Save starius/71f871ba6d7cd6f53ceb40d6c98f66b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/windows/stddialogs.cpp b/windows/stddialogs.cpp | |
index 1111111..2222222 100644 | |
--- a/windows/stddialogs.cpp | |
+++ b/windows/stddialogs.cpp | |
@@ -102,15 +102,30 @@ char *uiSaveFile(uiWindow *parent) | |
// TODO switch to TaskDialogIndirect()? | |
+typedef HRESULT (*WINAPI Tfv_TaskDialog)(_In_opt_ HWND hwndOwner, _In_opt_ HINSTANCE hInstance, _In_opt_ PCWSTR pszWindowTitle, _In_opt_ PCWSTR pszMainInstruction, _In_opt_ PCWSTR pszContent, TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons, _In_opt_ PCWSTR pszIcon, int *pnButton); | |
+Tfv_TaskDialog fv_TaskDialog = NULL; | |
+ | |
static void msgbox(HWND parent, const char *title, const char *description, TASKDIALOG_COMMON_BUTTON_FLAGS buttons, PCWSTR icon) | |
{ | |
WCHAR *wtitle, *wdescription; | |
HRESULT hr; | |
+ if (fv_TaskDialog == NULL) { | |
+ fv_TaskDialog = reinterpret_cast<Tfv_TaskDialog>( | |
+ GetProcAddress( | |
+ GetModuleHandle(L"comctl32.dll"), | |
+ "TaskDialog" | |
+ ) | |
+ ); | |
+ if (fv_TaskDialog == NULL) { | |
+ logHRESULT(L"error loading TaskDialog function", hr); | |
+ } | |
+ } | |
+ | |
wtitle = toUTF16(title); | |
wdescription = toUTF16(description); | |
- hr = TaskDialog(parent, NULL, NULL, wtitle, wdescription, buttons, icon, NULL); | |
+ hr = fv_TaskDialog(parent, NULL, NULL, wtitle, wdescription, buttons, icon, NULL); | |
if (hr != S_OK) | |
logHRESULT(L"error showing task dialog", hr); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment