mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Try to do a GetProcAddress to grab the function pointer to the
function
This commit is contained in:
parent
c9b88fa1ab
commit
1521a8dd38
48
deps/libui/win32/stddialogs.cpp
vendored
48
deps/libui/win32/stddialogs.cpp
vendored
@ -1,21 +1,26 @@
|
|||||||
// 22 may 2015
|
/* 22 may 2015 */
|
||||||
|
#include <dynamic/dylib.h>
|
||||||
#include "uipriv_windows.hpp"
|
#include "uipriv_windows.hpp"
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#include "winextra.h"
|
#include "winextra.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO document all this is what we want
|
static dylib_t comctl_dll_handle = NULL; /* Handle to Comctl32 */
|
||||||
// TODO do the same for font and color buttons
|
|
||||||
|
|
||||||
// notes:
|
/*
|
||||||
// - FOS_SUPPORTSTREAMABLEITEMS doesn't seem to be supported on windows vista, or at least not with the flags we use
|
* TODO document all this is what we want
|
||||||
// - even with FOS_NOVALIDATE the dialogs will reject invalid filenames (at least on Vista, anyway)
|
* TODO do the same for font and color buttons
|
||||||
// - lack of FOS_NOREADONLYRETURN doesn't seem to matter on Windows 7
|
|
||||||
|
|
||||||
// TODO
|
* notes:
|
||||||
// - http://blogs.msdn.com/b/wpfsdk/archive/2006/10/26/uncommon-dialogs--font-chooser-and-color-picker-dialogs.aspx
|
* - FOS_SUPPORTSTREAMABLEITEMS doesn't seem to be supported on windows vista, or at least not with the flags we use
|
||||||
// - when a dialog is active, tab navigation in other windows stops working
|
* - even with FOS_NOVALIDATE the dialogs will reject invalid filenames (at least on Vista, anyway)
|
||||||
// - when adding uiOpenFolder(), use IFileDialog as well - https://msdn.microsoft.com/en-us/library/windows/desktop/bb762115%28v=vs.85%29.aspx
|
* - lack of FOS_NOREADONLYRETURN doesn't seem to matter on Windows 7
|
||||||
|
|
||||||
|
* TODO
|
||||||
|
* - http://blogs.msdn.com/b/wpfsdk/archive/2006/10/26/uncommon-dialogs--font-chooser-and-color-picker-dialogs.aspx
|
||||||
|
* - when a dialog is active, tab navigation in other windows stops working
|
||||||
|
* - when adding uiOpenFolder(), use IFileDialog as well - https://msdn.microsoft.com/en-us/library/windows/desktop/bb762115%28v=vs.85%29.aspx
|
||||||
|
*/
|
||||||
|
|
||||||
#define windowHWND(w) ((HWND) uiControlHandle(uiControl(w)))
|
#define windowHWND(w) ((HWND) uiControlHandle(uiControl(w)))
|
||||||
|
|
||||||
@ -104,19 +109,28 @@ char *uiSaveFile(uiWindow *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO switch to TaskDialogIndirect()?
|
// TODO switch to TaskDialogIndirect()?
|
||||||
|
typedef HRESULT (WINAPI *TaskDialogProc)(HWND hwndParent,HINSTANCE hInstance,PCWSTR pszWindowTitle,PCWSTR pszMainInstruction,PCWSTR pszContent,TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons,PCWSTR pszIcon,int *pnButton);
|
||||||
|
static TaskDialogProc task_dialog_proc;
|
||||||
|
|
||||||
static void msgbox(HWND parent, const char *title, const char *description, TASKDIALOG_COMMON_BUTTON_FLAGS buttons, PCWSTR icon)
|
static void msgbox(HWND parent, const char *title, const char *description,
|
||||||
|
TASKDIALOG_COMMON_BUTTON_FLAGS buttons, PCWSTR icon)
|
||||||
{
|
{
|
||||||
WCHAR *wtitle, *wdescription;
|
HRESULT hr = E_FAIL;
|
||||||
HRESULT hr;
|
WCHAR *wtitle = toUTF16(title);
|
||||||
|
WCHAR *wdescription = toUTF16(description);
|
||||||
|
|
||||||
wtitle = toUTF16(title);
|
comctl_dll_handle = dylib_load("comctl32.lib");
|
||||||
wdescription = toUTF16(description);
|
|
||||||
|
task_dialog_proc = (TaskDialogProc)GetProcAddress((HINSTANCE)comctl_dll_handle, "TaskDialog");
|
||||||
|
|
||||||
|
if (task_dialog_proc)
|
||||||
|
hr = task_dialog_proc(parent, NULL, NULL, wtitle, wdescription, buttons, icon, NULL);
|
||||||
|
|
||||||
hr = TaskDialog(parent, NULL, NULL, wtitle, wdescription, buttons, icon, NULL);
|
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
logHRESULT(L"error showing task dialog", hr);
|
logHRESULT(L"error showing task dialog", hr);
|
||||||
|
|
||||||
|
dylib_close(comctl_dll_handle);
|
||||||
|
|
||||||
uiFree(wdescription);
|
uiFree(wdescription);
|
||||||
uiFree(wtitle);
|
uiFree(wtitle);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user