There's no other way other than hooks.
If you install a CBT_HOOK, you only hook window
creation, activation etc (in other words, not many
messages). But, it's enough to do whatever customization
you want.
//
// MsgBoxEx - how to customize a standard message box
// Written by J Brown 2002
// Freeware
//
#include <windows.h>
#include <tchar.h>
int MsgBoxEx(HWND hwnd, TCHAR *szText, TCHAR *szCaption, UINT uType)
{
int retval;
// Install a window hook, so we can intercept the message-box
// creation, and customize it
hMsgBoxHook = SetWindowsHookEx(
WH_CBT,
CBTProc,
NULL,
GetCurrentThreadId() // Only install for THIS thread!!!
);
// Display a standard message box
retval = MessageBox(hwnd, szText, szCaption, uType);
// remove the window hook
UnhookWindowsHookEx(hMsgBoxHook);
return retval;
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int
nShowCmd)
{
// Just display a standard message box.
// It doesn't matter that we have no parent window or a
// message-loop, because MessageBox has it's own message loop.