Code Repo    |     RSS
MD's Technical Sharing



Sunday, January 11, 2009

MessageBox with Help button

Showing a four-button message box with the default set to the fourth button:


int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hinstPrev,
LPSTR lpCmdLine, int nShowCmd)
{
return MessageBox(NULL, TEXT("Four buttons!"), TEXT("Title"), MB_ABORTRETRYIGNORE | MB_HELP | MB_DEFBUTTON4);
}


Clicking on the Help button (MB_HELP) is documented as sending a WM_HELP message to your program. Since there is nothing to catch that message, it does nothing. The other buttons return the ID value of that button, dismissing the message box.


Reference:

msdn.com/oldnewthing/archive/2008/12/19/9239267.aspx

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.