挂钩MessageBox更改按钮文本 - 调整按钮大小? [英] Hooking MessageBox to change button text - Resize buttons too?
本文介绍了挂钩MessageBox更改按钮文本 - 调整按钮大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我今天看到这篇文章:
http:// www.codeguru.com/cpp/wp/win32/messagebox/article.php/c10873/MessageBox-with-Custom-Button-Captions.htm [ ^ ]
它就像一个冠军!
我想知道当MessageBox被挂钩时它是否也可能加宽接收新文本的按钮,显示稍微大一点的字符串。
谢谢。
:ron
Hi,
I saw this article today:
http://www.codeguru.com/cpp/w-p/win32/messagebox/article.php/c10873/MessageBox-with-Custom-Button-Captions.htm[^]
And it works like a champ!
I was wondering if it was also then possible while the MessageBox was hooked, to widen the buttons that recieve the new text just a bit to display a somewhat larger string.
Thanks.
:ron
推荐答案
检查一下:
Check it :
static LRESULT __stdcall ChangeCaptions(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HCBT_ACTIVATE) {
SetWindowText(GetDlgItem((HWND) wParam, IDOK), L10N(GUI_OK_MSG));
SetWindowText(GetDlgItem((HWND) wParam, IDCANCEL), L10N(GUI_CANCEL_MSG));
SetWindowText(GetDlgItem((HWND) wParam, IDYES), L10N(GUI_YES_MSG));
SetWindowText(GetDlgItem((HWND) wParam, IDNO), L10N(GUI_NO_MSG));
}
return 0;
}
int addon_gui_messagebox(HWND parentHWnd, HINSTANCE hInstance, void *text, void *caption, int type)
{
int ret;
hook = SetWindowsHookEx(WH_CBT, ChangeCaptions, hInstance, GetCurrentThreadId());
ret = MessageBox(parentHWnd, text, caption, type);
UnhookWindowsHookEx(hook);
return ret;
}
这篇关于挂钩MessageBox更改按钮文本 - 调整按钮大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文