tags:

views:

278

answers:

2

We have a legacy application written in C that uses WinAPI. We'd like to add a "Yes to All" button to a few of our dialog boxes. Unfortunately, the existing MessageBox function does not allow for custom buttons or button captions.

What's the best way to do so? Is there a slick hack to easily add a custom button? Or should we create our own MessageBox replacement?

+1  A: 

There is another kind of a message box in WinAPI, since Windows 2000. It's SHMessageBoxCheck.

It allows you to display a standard MB_OKCANCEL/MB_YESNO/MB_OK-type MessageBox with the option to Never show it again, by specifying which the default option in that case is.

Maybe it's not exactly what you're looking for, but it's fairly consistent with Windows UI.

In Vista most of the shell's "Yes to all" dialogs actually work this way - there's no additional button saying "Yes/No to all" - there's a "Perform chosen action on all items" checkbox instead.

However the Note in documentation worries me:

This function is available through Microsoft Windows XP and Windows Server 2003. It might be altered or unavailable in subsequent versions of Windows.

macbirdie