summary8:GetSystemMetrics、SetWindowPos、 ModifyStyleEx

发布时间:2025-12-09 13:58:02 浏览次数:4

1.

int iWidth = GetSystemMetrics(SM_CXSCREEN);//the width of screenint iHeight = GetSystemMetrics(SM_CYSCREEN);//the hight of screen::SetWindowPos(this->GetSafeHwnd(), HWND_TOPMOST, iWidth/2 - 120, iHeight/2 - 60 , 0, 0, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER );//set the window position    ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW);//hide the icon on the toolbar

WINUSERAPI BOOL WINAPI SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);

hwnd: 窗口句柄

hWndInsertAfter: CWnd对象

X: 指定窗口新位置的左边界

Y:指定窗口新位置的顶边界

cx: 以像素指定窗口的新宽度

cy:以像素指定窗口的新高度

uFlags: 窗口尺寸和定位标志

z序的意思:窗口总是矩形的,它们沿着垂直于屏幕的假想直线相互堆叠在一起。堆叠在一起的窗口称为z序。每个窗口在z序中具有唯一的位置。在z序位置靠前的窗口位于位置靠后的窗口的前面或顶部。窗口在z序中的位置影响它的外观。

https://baike.baidu.com/item/SetWindowPos/6376849?fr=aladdin

CWnd::SetWindowPos(……)//设置当前对话框的位置

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477