码迷,mamicode.com
首页 > 编程语言 > 详细

VC++ 判断你的窗口是否置顶TopMost

时间:2017-11-09 14:36:36      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:not   c++   ble   rmi   dep   height   always on   round   ica   

  大家可能已经知道,使你的窗口置顶(TopMost)或者总是最前(Always on Top)的方法:

 C++ Code 
1
2
3
4
5
 
// Make topmost
::SetWindowPos(hwnd, HWND_TOPMOST0000SWP_NOMOVE SWP_NOSIZE);
 
// Revert back
::SetWindowPos(hwnd, HWND_NOTOPMOST0000SWP_NOMOVE SWP_NOSIZE);

  但是,你如何决定自己的窗口是否为TopMost状态?哈哈,可以这样来做:

 C++ Code 
1
2
3
4
5
6
7
8
 
if (::GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
{
    ... 
// The window is topmost.
}
else
{
    ... 
// The window is not topmost.
}

  解释:当SetWindowsPos()使窗口TopMost时,也同时为窗口提供了 WS_EX_TOPMOST 扩展样式。.

  出处:https://www.codeproject.com/Tips/269140/How-to-determine-if-your-window-is-topmost

VC++ 判断你的窗口是否置顶TopMost

标签:not   c++   ble   rmi   dep   height   always on   round   ica   

原文地址:http://www.cnblogs.com/MakeView660/p/7808720.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!