SetWindowPos的作用

本文介绍了Windows API中的SetWindowPos函数,详细解释了如何使用该函数调整窗口的位置、大小及显示层级,并提供了示例代码。

 

SetWindowPos的作用:
       在MSDN里面是这样表述的:The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order。
BOOL SetWindowPos(      

    HWND hWnd,
    HWND hWndInsertAfter,
    int X,
    int Y,
    int cx,
    int cy,
    UINT uFlags
);它可以设置对话框的位置大小和显示模式,也可以设置显示的层次如Z轴的最顶层,例如:
::SetWindowPos(AfxGetApp()->m_pMainWnd->m_hWnd,IsDlgButtonChecked(IDC_CHECK1)?HWND_TOPMOST:HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
HWND_TOPMOST设置显示位置是最顶层,也就是最外层,这看上去有点类似,对话框里的非模态对话框
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值