messagebox可以改大小吗? 用哪个参数?没找着.太小看着不舒服,想改大一点. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不可以,除非你在MessageBox前新建一个线程来FindWindow不过这样做还不如用 DoModal 来显示一个新的对话框 INT CBTMessageBox(HWND hwnd, LPSTR lpText, LPSTR lpCaption, UINT uType){ hhk = SetWindowsHookEx(WH_CBT, &CBTProc, 0, GetCurrentThreadId()); return MessageBox(hwnd, lpText, lpCaption, uType);}LRESULT CALLBACK CBTProc(INT nCode, WPARAM wParam, LPARAM lParam){ HWND hParentWnd, hChildWnd; // msgbox is "child" RECT rParent, rChild, rDesktop; POINT pCenter, pStart; INT nWidth, nHeight; // notification that a window is about to be activated // window handle is wParam if (nCode == HCBT_ACTIVATE) { // set window handles hParentWnd = GetForegroundWindow(); hChildWnd = (HWND)wParam; if((hParentWnd != 0) && (hChildWnd != 0) && (GetWindowRect(GetDesktopWindow(), &rDesktop) != 0) && (GetWindowRect(hParentWnd, &rParent) != 0) && (GetWindowRect(hChildWnd, &rChild) != 0)) { // calculate message box dimensions nWidth = (rChild.right - rChild.left); nHeight = (rChild.bottom - rChild.top); // calculate parent window center point pCenter.x = rParent.left+((rParent.right - rParent.left)/2); pCenter.y = rParent.top+((rParent.bottom - rParent.top)/2); // calculate message box starting point pStart.x = (pCenter.x - (nWidth/2)); pStart.y = (pCenter.y - (nHeight/2)); // adjust if message box is off desktop if(pStart.x < 0) pStart.x = 0; if(pStart.y < 0) pStart.y = 0; if(pStart.x + nWidth > rDesktop.right) pStart.x = rDesktop.right - nWidth; if(pStart.y + nHeight > rDesktop.bottom) pStart.y = rDesktop.bottom - nHeight; // move message box MoveWindow(hChildWnd, pStart.x, pStart.y, nWidth, nHeight, FALSE); } // exit CBT hook UnhookWindowsHookEx(hhk); } // otherwise, continue with any possible chained hooks else CallNextHookEx(hhk, nCode, wParam, lParam); return 0;} 有类似于QQ标签窗口分离源码吗 麻烦发给我邮箱下 谢谢 MYSQL中的插入语句 如何改变工具栏的背景色 如何实现安装后立即启动Desktop Band程序. 有关游戏木马所使用的技术(讨论) 为啥偶的托盘右键菜单老是“应用程序错误”!! 绘图问题(有关区域的重叠问题),在线等 如何用最简便的方法检测一个HTTP代理服务器是否有效??另外如何知道HTTP代理是否支持SSL? 这个程序哪里错了 PC机向打印机(Epson兼容)发送的信息码是哪种格式的?? 立即结贴——请问VC界面中有没有向导可以删除一个类的 Xerces中有类似MSXML的SelectNodes()这个函数吗?
不过这样做还不如用 DoModal 来显示一个新的对话框
INT CBTMessageBox(HWND hwnd, LPSTR lpText, LPSTR lpCaption,
UINT uType)
{
hhk = SetWindowsHookEx(WH_CBT, &CBTProc, 0,
GetCurrentThreadId());
return MessageBox(hwnd, lpText, lpCaption, uType);
}LRESULT CALLBACK CBTProc(INT nCode, WPARAM wParam, LPARAM lParam)
{
HWND hParentWnd, hChildWnd; // msgbox is "child"
RECT rParent, rChild, rDesktop;
POINT pCenter, pStart;
INT nWidth, nHeight; // notification that a window is about to be activated
// window handle is wParam
if (nCode == HCBT_ACTIVATE)
{
// set window handles
hParentWnd = GetForegroundWindow();
hChildWnd = (HWND)wParam; if((hParentWnd != 0) &&
(hChildWnd != 0) &&
(GetWindowRect(GetDesktopWindow(), &rDesktop) != 0) &&
(GetWindowRect(hParentWnd, &rParent) != 0) &&
(GetWindowRect(hChildWnd, &rChild) != 0))
{
// calculate message box dimensions
nWidth = (rChild.right - rChild.left);
nHeight = (rChild.bottom - rChild.top); // calculate parent window center point
pCenter.x = rParent.left+((rParent.right
- rParent.left)/2);
pCenter.y = rParent.top+((rParent.bottom
- rParent.top)/2); // calculate message box starting point
pStart.x = (pCenter.x - (nWidth/2));
pStart.y = (pCenter.y - (nHeight/2)); // adjust if message box is off desktop
if(pStart.x < 0) pStart.x = 0;
if(pStart.y < 0) pStart.y = 0;
if(pStart.x + nWidth > rDesktop.right)
pStart.x = rDesktop.right - nWidth;
if(pStart.y + nHeight > rDesktop.bottom)
pStart.y = rDesktop.bottom - nHeight; // move message box
MoveWindow(hChildWnd,
pStart.x, pStart.y,
nWidth, nHeight,
FALSE);
}
// exit CBT hook
UnhookWindowsHookEx(hhk);
}
// otherwise, continue with any possible chained hooks
else CallNextHookEx(hhk, nCode, wParam, lParam);
return 0;
}