Does anyone know how MessageBox(…) could fail silently?
MessageBox(g_hMainhWnd, buffer, "Oops!", MB_OK | MB_ICONERROR);
ShellExecute(0, "open", "http://intranet/crash_handler.php", NULL, "", SW_SHOWNORMAL);
For a little context, this code is called inside our own exception handler, which was registered with SetUnhandledExceptionFilter()
Most of the time, I see the message box, and then it launches a web browser.
However, I have an exe, which as far as I’m aware uses this exact code, and it successfully launches the web browser, but I do not see the message box first.
Thanks
Tim
Cracked it. I tried deliberately passing in a garbage HWND and the message box didn’t appear.
Thanks Brian!
Just an idea but maybe
g_hMainhWndis invalid? See if it works when you putNULLfor the first parameter.I would suggest to call
GetLastErrorafter the call and write the output to a file. That way you can see what Windows thinks the error is. The MSDN MessageBox documentation mentions that it setsGetLastErrorfor this API and if it fails it returns zero.