Felix Schindler
Felix Schindler

Reputation: 127

Message boxes are not shown MessageBoxA()

There is something curious going on on my Windows machine. I have an application that calls MessageBoxA(...)

auto errorCode = MessageBoxA(NULL, "Somtext", "Sometitle", MB_YESNO | MB_TASKMODAL | MB_SETFOREGROUND | MB_DEFBUTTON1);

The problem is that the message box is never shown. The call to MessageBoxA(...) returns immediately and errorCode tells me that the default button was pressed. So far so strange. In addition to that here is what I also found out.

I'm running Windows 7 embedded. Is there someone out there which has an idea what's going on here?

Upvotes: 1

Views: 827

Answers (1)

Felix Schindler
Felix Schindler

Reputation: 127

The problem are those two registry keys:

HKLM\System\CurrentControlSet\Control\Error Message Instrument\EnableDefaultReply
  • 0 = "Disable" clicking the "default button"
  • 1 = "Enable" clicking the "default button"

and

HKLM\System\CurrentControlSet\Control\Error Message Instrument\EnableLogging
  • 0 = Do not log message boxes that have been handled by Dialog box filter (Application Log)

  • 1 = Log message boxes that have been handled by Dialog box filter (Application Log)

A discussion about this can be found here

Thank you Hans Passant

Upvotes: 2

Related Questions