Using CoreFoundation, I can display an alert dialog with the following:
CFUserNotificationDisplayAlert(0.0,
kCFUserNotificationPlainAlertLevel,
NULL, NULL, NULL,
CFSTR("Alert title"),
CFSTR("Yes?),
CFSTR("Affirmative"),
CFSTR("Nah"),
NULL, NULL);
How do I replicate this using the Windows C API? The closest I’ve gotten is:
MessageBox(NULL, "Yes?", "Alert title", MB_OKCANCEL);
but that hard-codes “OK” and “Cancel” as the button titles, which is not what I want. Is there any way around this, or an alternative function to use?
You can use SetWindowText to change the legend on the buttons. Because the MessageBox() blocks the flow of execution you need some mechanism to get round this – the code below uses a timer.
I think the FindWindow code may be dependent on there being no parent for MessageBox() but I’m not sure.