diff --git a/video/win32_v.c b/video/win32_v.c index cee38a7943..f260f2e230 100644 --- a/video/win32_v.c +++ b/video/win32_v.c @@ -212,6 +212,7 @@ static void CALLBACK TrackMouseTimerProc(HWND hwnd, UINT msg, UINT event, DWORD static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static uint32 keycode = 0; + static bool console = false; switch (msg) { case WM_CREATE: @@ -363,6 +364,10 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP } #endif /* UNICODE */ + case WM_DEADCHAR: + console = GB(lParam, 16, 8) == 41; + return 0; + case WM_CHAR: { uint scancode = GB(lParam, 16, 8); uint charcode = wParam; @@ -370,6 +375,13 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP /* Silently drop all non-text messages as those were handled by WM_KEYDOWN */ if (wParam < VK_SPACE) return 0; + /* If the console key is a dead-key, we need to press it twice to get a WM_CHAR message. + * But we then get two WM_CHAR messages, so ignore the first one */ + if (console && scancode == 41) { + console = false; + return 0; + } + #if !defined(UNICODE) { wchar_t w; diff --git a/win32.c b/win32.c index ebfffb4502..30f01eb9e0 100644 --- a/win32.c +++ b/win32.c @@ -887,6 +887,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi * save it because argv[] points into this buffer and thus needs to * be available between subsequent calls to FS2OTTD() */ char cmdlinebuf[MAX_PATH]; + + /* Check if a win9x user started the win32 version */ + if (HASBIT(GetVersion(), 31)) error("This version of OpenTTD doesn't run on windows 95/98/ME.\nPlease download the win9x binary and try again."); #endif /* UNICODE */ cmdline = WIDE_TO_MB_BUFFER(GetCommandLine(), cmdlinebuf, lengthof(cmdlinebuf));