Improve MSVC6 hacks

This commit is contained in:
Clownacy 2020-03-14 14:08:25 +00:00
parent c6b77fb015
commit 76e4fb5e8a
4 changed files with 18 additions and 13 deletions

View file

@ -17,7 +17,7 @@ static const char *version_string =
; ;
// TODO - Inaccurate stack frame // 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]; char string_buffer[104];
@ -58,7 +58,7 @@ INT_PTR CALLBACK VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
return FALSE; 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; (void)lParam;
@ -102,7 +102,7 @@ INT_PTR CALLBACK DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPar
return FALSE; 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]; char string[100];
@ -135,7 +135,7 @@ INT_PTR CALLBACK DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPar
return FALSE; 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) switch (Msg)
{ {

View file

@ -2,7 +2,7 @@
#include "WindowsWrapper.h" #include "WindowsWrapper.h"
INT_PTR CALLBACK VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); DLGPROC_RET CALLBACK VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); DLGPROC_RET CALLBACK DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); DLGPROC_RET 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 QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

View file

@ -676,12 +676,12 @@ LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPar
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case 40001: 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); PostMessageA(hWnd, WM_CLOSE, 0, 0);
break; break;
case 40002: case 40002:
DialogBoxParamA(ghInstance, "DLG_ABOUT", hWnd, (DLGPROC)VersionDialog, 0); DialogBoxParamA(ghInstance, "DLG_ABOUT", hWnd, VersionDialog, 0);
break; break;
case 40004: case 40004:
@ -690,11 +690,11 @@ LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPar
break; break;
case 40005: case 40005:
DialogBoxParamA(ghInstance, "DLG_SAVE", hWnd, (DLGPROC)DebugSaveDialog, 0); DialogBoxParamA(ghInstance, "DLG_SAVE", hWnd, DebugSaveDialog, 0);
break; break;
case 40007: case 40007:
DialogBoxParamA(ghInstance, "DLG_MUTE", hWnd, (DLGPROC)DebugMuteDialog, 0); DialogBoxParamA(ghInstance, "DLG_MUTE", hWnd, DebugMuteDialog, 0);
break; break;
} }

View file

@ -3,7 +3,7 @@
#include <windows.h> #include <windows.h>
// Visual Studio 6 is missing these, so define them here // Visual Studio 6 is missing these, so define them here
#ifdef _MSC_VER #if defined(_MSC_VER) && _MSC_VER <= 1200
#ifndef VK_OEM_PLUS #ifndef VK_OEM_PLUS
#define VK_OEM_PLUS 0xBB #define VK_OEM_PLUS 0xBB
#endif #endif
@ -23,4 +23,9 @@
#ifndef DWORD_PTR #ifndef DWORD_PTR
#define DWORD_PTR DWORD #define DWORD_PTR DWORD
#endif #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 #endif