ref: 76e4fb5e8a2faa1aa6211950286c84ddc02053ea
parent: c6b77fb01555a5879af4c5cfe7d12af0be2a2ec6
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sat Mar 14 10:08:25 EDT 2020
Improve MSVC6 hacks
--- a/src/Dialog.cpp
+++ b/src/Dialog.cpp
@@ -17,7 +17,7 @@
;
// TODO - Inaccurate stack frame
-INT_PTR CALLBACK VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+DLGPROC_RET CALLBACK VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
char string_buffer[104];
@@ -58,7 +58,7 @@
return FALSE;
}
-INT_PTR CALLBACK DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+DLGPROC_RET CALLBACK DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
(void)lParam;
@@ -102,7 +102,7 @@
return FALSE;
}
-INT_PTR CALLBACK DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+DLGPROC_RET CALLBACK DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
char string[100];
@@ -135,7 +135,7 @@
return FALSE;
}
-INT_PTR CALLBACK QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+DLGPROC_RET CALLBACK QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
--- a/src/Dialog.h
+++ b/src/Dialog.h
@@ -2,7 +2,7 @@
#include "WindowsWrapper.h"
-INT_PTR CALLBACK VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+DLGPROC_RET CALLBACK VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+DLGPROC_RET CALLBACK DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+DLGPROC_RET CALLBACK DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+DLGPROC_RET CALLBACK QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -676,12 +676,12 @@
switch (LOWORD(wParam))
{
case 40001:
- if (DialogBoxParamA(ghInstance, "DLG_YESNO", hWnd, (DLGPROC)QuitDialog, (LPARAM)"Quit?") == 1)
+ if (DialogBoxParamA(ghInstance, "DLG_YESNO", hWnd, QuitDialog, (LPARAM)"Quit?") == 1)
PostMessageA(hWnd, WM_CLOSE, 0, 0);
break;
case 40002:
- DialogBoxParamA(ghInstance, "DLG_ABOUT", hWnd, (DLGPROC)VersionDialog, 0);
+ DialogBoxParamA(ghInstance, "DLG_ABOUT", hWnd, VersionDialog, 0);
break;
case 40004:
@@ -690,11 +690,11 @@
break;
case 40005:
- DialogBoxParamA(ghInstance, "DLG_SAVE", hWnd, (DLGPROC)DebugSaveDialog, 0);
+ DialogBoxParamA(ghInstance, "DLG_SAVE", hWnd, DebugSaveDialog, 0);
break;
case 40007:
- DialogBoxParamA(ghInstance, "DLG_MUTE", hWnd, (DLGPROC)DebugMuteDialog, 0);
+ DialogBoxParamA(ghInstance, "DLG_MUTE", hWnd, DebugMuteDialog, 0);
break;
}
--- a/src/WindowsWrapper.h
+++ b/src/WindowsWrapper.h
@@ -3,7 +3,7 @@
#include <windows.h>
// Visual Studio 6 is missing these, so define them here
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && _MSC_VER <= 1200
#ifndef VK_OEM_PLUS
#define VK_OEM_PLUS 0xBB
#endif
@@ -23,4 +23,9 @@
#ifndef DWORD_PTR
#define DWORD_PTR DWORD
#endif
+
+ // DLGPROC went from returning BOOL to INT_PTR in later versions, and VC6 doesn't like that
+ #define DLGPROC_RET BOOL
+#else
+ #define DLGPROC_RET INT_PTR
#endif