tWin32 startup errors now displayed with a standard MessageBox - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 2a6e35aef3c23dc1f6d92224fd35112771adff60
(DIR) parent f40f0dd9b38a9fe1905d800b88b8b2679344e947
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Thu, 26 Apr 2001 03:22:56 +0000
Win32 startup errors now displayed with a standard MessageBox
Diffstat:
M src/winmain.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/src/winmain.c b/src/winmain.c
t@@ -49,12 +49,17 @@ static void ServerLogMessage(const gchar *log_domain,GLogLevelFlags log_level,
g_free(text);
}
-static void Win32PrintFunc(const gchar *string) {
+static void ServerPrintFunc(const gchar *string) {
DWORD NumChar;
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),string,strlen(string),
&NumChar,NULL);
}
+static void LogMessage(const gchar *log_domain,GLogLevelFlags log_level,
+ const gchar *message,gpointer user_data) {
+ MessageBox(NULL,message,"Error",MB_OK|MB_ICONSTOP);
+}
+
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
LPSTR lpszCmdParam,int nCmdShow) {
gchar **split;
t@@ -64,7 +69,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
bindtextdomain(PACKAGE,LOCALEDIR);
textdomain(PACKAGE);
#endif
- SetupParameters();
+ g_log_set_handler(NULL,G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_WARNING,
+ LogMessage,NULL);
split=g_strsplit(lpszCmdParam," ",0);
argc=0;
while (split[argc] && split[argc][0]) argc++;
t@@ -75,7 +81,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
SetConsoleTitle(_("dopewars server"));
g_log_set_handler(NULL,G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_WARNING,
ServerLogMessage,NULL);
- g_set_print_handler(Win32PrintFunc);
+ g_set_print_handler(ServerPrintFunc);
newterm(NULL,NULL,NULL);
ServerLoop();
} else if (AIPlayer) {