Fixed the windows message debug output so it works without HAVE_LIBC
authorSam Lantinga <slouken@libsdl.org>
Mon, 14 Oct 2013 08:56:50 -0700
changeset 7816 f16e342b167a
parent 7815 a8de34099dec
child 7817 357bccc72a1c
Fixed the windows message debug output so it works without HAVE_LIBC
src/video/windows/SDL_windowsevents.c
--- a/src/video/windows/SDL_windowsevents.c	Mon Oct 14 08:56:45 2013 -0700
+++ b/src/video/windows/SDL_windowsevents.c	Mon Oct 14 08:56:50 2013 -0700
@@ -309,18 +309,16 @@
     }
 
 #ifdef WMMSG_DEBUG
-    {
-        FILE *log = fopen("wmmsg.txt", "a");
-        fprintf(log, "Received windows message: %p ", hwnd);
-        if (msg > MAX_WMMSG) {
-            fprintf(log, "%d", msg);
-        } else {
-            fprintf(log, "%s", wmtab[msg]);
-        }
-        fprintf(log, " -- 0x%X, 0x%X\n", wParam, lParam);
-        fclose(log);
-    }
-#endif
+	{
+		char message[1024];
+		if (msg > MAX_WMMSG) {
+			SDL_snprintf(message, sizeof(message), "Received windows message: %p UNKNOWN (%d) -- 0x%X, 0x%X\n", hwnd, msg, wParam, lParam);
+		} else {
+			SDL_snprintf(message, sizeof(message), "Received windows message: %p %s -- 0x%X, 0x%X\n", hwnd, wmtab[msg], wParam, lParam);
+		}
+		OutputDebugStringA(message);
+	}
+#endif /* WMMSG_DEBUG */
 
     if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata))
         return 0;