Currently viewing: GipsySoft » Front Page» Articles

GSMessageBox - Checkbox

The code

	UINT uCheckState = 1;
GSMSGBOX msg = { 0 };
msg.cbSize = sizeof( msg );
msg.uFlags = GS_MSGBOX_CHECKBOX;
msg.pcszCheckBoxText = _T("Don't show this again");
msg.puValue = &uCheckState;
(void)GSMessageBox( NULL
  , _T("Checkbox test of course. What a pain this is to achieve normally!")
  , _T("Caption")
  , MB_OKCANCEL | MB_DEFBUTTON2
  , &msg );

Notes

All we do is declare an appropriate structure, set some values and then call the API.

  • uCheckState is used to set the state of the checkbox as well as return the value of the checkbox.

Screenshot