X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=event.cpp;h=0bf8960f9a0c8af76160d3e30b0feac846a8a4b1;hb=8d884cbd586f2c3158708eea541ea62508506907;hp=4af50a86a925399aa93c8d4835742406c6f7ad84;hpb=dd0e555ba889a74ae14487ca0b4a5c62cfa4d873;p=nssm.git diff --git a/event.cpp b/event.cpp index 4af50a8..0bf8960 100644 --- a/event.cpp +++ b/event.cpp @@ -1,5 +1,6 @@ #include "nssm.h" +#define NSSM_SOURCE _T("nssm") #define NSSM_ERROR_BUFSIZE 65535 #define NSSM_NUM_EVENT_STRINGS 16 unsigned long tls_index; @@ -42,7 +43,7 @@ void log_event(unsigned short type, unsigned long id, ...) { TCHAR *strings[NSSM_NUM_EVENT_STRINGS]; /* Open event log */ - HANDLE handle = RegisterEventSource(0, NSSM); + HANDLE handle = RegisterEventSource(0, NSSM_SOURCE); if (! handle) return; /* Log it */ @@ -72,7 +73,7 @@ void print_message(FILE *file, unsigned long id, ...) { } /* Show a GUI dialogue */ -int popup_message(unsigned int type, unsigned long id, ...) { +int popup_message(HWND owner, unsigned int type, unsigned long id, ...) { va_list arg; TCHAR *format = message_string(id); @@ -89,7 +90,20 @@ int popup_message(unsigned int type, unsigned long id, ...) { } va_end(arg); - int ret = MessageBox(0, blurb, NSSM, type); + MSGBOXPARAMS params; + ZeroMemory(¶ms, sizeof(params)); + params.cbSize = sizeof(params); + params.hInstance = GetModuleHandle(0); + params.hwndOwner = owner; + params.lpszText = blurb; + params.lpszCaption = NSSM; + params.dwStyle = type; + if (type == MB_OK) { + params.dwStyle |= MB_USERICON; + params.lpszIcon = MAKEINTRESOURCE(IDI_NSSM); + } + + int ret = MessageBoxIndirect(¶ms); LocalFree(format);