Got rid of the TaskDialog() linker kludge. This will require a version of MinGW-w64 newer than available; there's a patch I need to submit for approval for that.

This commit is contained in:
Pietro Gagliardi 2015-06-07 14:05:18 -04:00
parent bf9e43b185
commit cb1b5ee48b
2 changed files with 2 additions and 11 deletions

View File

@ -62,27 +62,17 @@ char *uiSaveFile(void)
FOS_OVERWRITEPROMPT | FOS_NOCHANGEDIR | FOS_ALLNONSTORAGEITEMS | FOS_NOVALIDATE | FOS_SHAREAWARE | FOS_NOTESTFILECREATE | FOS_NODEREFERENCELINKS | FOS_FORCESHOWHIDDEN | FOS_DEFAULTNOMINIMODE); FOS_OVERWRITEPROMPT | FOS_NOCHANGEDIR | FOS_ALLNONSTORAGEITEMS | FOS_NOVALIDATE | FOS_SHAREAWARE | FOS_NOTESTFILECREATE | FOS_NODEREFERENCELINKS | FOS_FORCESHOWHIDDEN | FOS_DEFAULTNOMINIMODE);
} }
// TODO MinGW-w64 4.0.0 doesn't have the Task Dialog functions in its .lib files
HRESULT (*WINAPI fv_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) = NULL;
static void msgbox(const char *title, const char *description, TASKDIALOG_COMMON_BUTTON_FLAGS buttons, PCWSTR icon) static void msgbox(const char *title, const char *description, TASKDIALOG_COMMON_BUTTON_FLAGS buttons, PCWSTR icon)
{ {
WCHAR *wtitle, *wdescription; WCHAR *wtitle, *wdescription;
HWND dialogHelper; HWND dialogHelper;
HRESULT hr; HRESULT hr;
if (fv_TaskDialog == NULL) {
HANDLE h;
h = LoadLibraryW(L"comctl32.dll");
fv_TaskDialog = GetProcAddress(h, "TaskDialog");
}
wtitle = toUTF16(title); wtitle = toUTF16(title);
wdescription = toUTF16(description); wdescription = toUTF16(description);
dialogHelper = beginDialogHelper(); dialogHelper = beginDialogHelper();
hr = (*fv_TaskDialog)(dialogHelper, NULL, NULL, wtitle, wdescription, buttons, icon, NULL); hr = TaskDialog(dialogHelper, NULL, NULL, wtitle, wdescription, buttons, icon, NULL);
if (hr != S_OK) if (hr != S_OK)
logHRESULT("error showing task dialog in msgbox()", hr); logHRESULT("error showing task dialog in msgbox()", hr);
endDialogHelper(dialogHelper); endDialogHelper(dialogHelper);

View File

@ -11,6 +11,7 @@
#if __MINGW64_VERSION_MAJOR < 4 #if __MINGW64_VERSION_MAJOR < 4
#error MinGW-w64 version 4.0.0 or newer is required. #error MinGW-w64 version 4.0.0 or newer is required.
#endif #endif
// TODO exact version once my changes get pushed
// ui internal window messages // ui internal window messages
enum { enum {