Can we have a message box with cancel button only ? If so , any hints ? Is there a built in api method to get only messagebox with cancel button alone/
How to create custom modal dialog ? Any Links ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use a thread-local CBT hook via
SetWindowsHookEx()to customize theMessageBox()dialog however you want.For instance, you can change the text of the “OK” button to say “Cancel” instead, eg:
Or you can hide the standard “OK” button and let the dialog still use its native “Cancel” button:
Update: on Vista and later, you can (and should) use
TaskDialog()orTaskDialogIndirect()instead ofMessageBox(). Task dialogs are much more flexible, including the ability to let you specify which buttons are on the dialog, and even use custom buttons. So you can easily display a Cancel-only dialog without using any hooks at all, eg: