diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index db8b3e9b..87efbe73 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -687,7 +687,7 @@ INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam } case IDM_WNDSPY: { - extern int ShowWndSpy(HWND hOwner); + extern INT_PTR ShowWndSpy(HWND hOwner); return ShowWndSpy(g_sdata.hwnd); } case IDM_GUIDGEN: @@ -943,6 +943,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } break; case WM_DESTROY: + DeleteObject(dd.hHeaderFont); DeleteObject(dd.hFont); DeleteObject(dd.hBoldFont); break; diff --git a/Contrib/Makensisw/utils.h b/Contrib/Makensisw/utils.h index a3604397..65b7b635 100644 --- a/Contrib/Makensisw/utils.h +++ b/Contrib/Makensisw/utils.h @@ -32,6 +32,14 @@ #endif #define COUNTOF(a) (sizeof(a)/sizeof(a[0])) +#if defined(_MSC_VER) && _MSC_VER >= 1200 +EXTERN_C IMAGE_DOS_HEADER __ImageBase; +#define HINST_THISCOMPONENT ( (HINSTANCE) &__ImageBase ) +#define HINST_APPLICATION HINST_THISCOMPONENT +#else +#define HINST_APPLICATION ( (HINSTANCE) GetModuleHandle(NULL) ) +#endif + #define MRU_LIST_SIZE 5 #define MRU_DISPLAY_LENGTH 40 #define SYMSETNAME_MAXLEN 40 diff --git a/Contrib/Makensisw/wndspy.cpp b/Contrib/Makensisw/wndspy.cpp index 51404bf2..55a7fcaa 100644 --- a/Contrib/Makensisw/wndspy.cpp +++ b/Contrib/Makensisw/wndspy.cpp @@ -380,12 +380,12 @@ struct ScopedThreadDpiAwarenessContext { // Note: Assumes InitializeDpiApi() has int m_AC; // Canonical "active" DPI_AWARENESS_CONTEXT }; -int ShowWndSpy(HWND hOwner) +INT_PTR ShowWndSpy(HWND hOwner) { InitializeDpiApi(); ScopedThreadDpiAwarenessContext::List aclist; ScopedThreadDpiAwarenessContext stdac(aclist << DPI::ac_pm2 << DPI::ac_system); DIALOGDATA dd; dd.DialogAwarenessContext = stdac.GetCanonicalActiveAwarenessContext(); - return DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(DLG_WNDSPY), hOwner, SpyDlgProc, (LPARAM) &dd); + return DialogBoxParam(HINST_APPLICATION, MAKEINTRESOURCE(DLG_WNDSPY), hOwner, SpyDlgProc, (LPARAM) &dd); }