MFC Windows 程序设计->最顶层窗口
2011-04-02 18:04
399 查看
The difference between a topmost window and a nontopmost window is an
extended window style bit. WS_EX_TOPMOST makes a window a topmost window. You
can create a topmost frame window by including a WS_EX_TOPMOST flag in the call
to Create, like this:
The alternative is to add the style bit after the window is created by
calling SetWindowPos with a &wndTopMost parameter, as shown
here:
You can convert a topmost window into a nontopmost window by calling
SetWindowPos with the first parameter equal to &wndNoTopMost
rather than &wndTopMost.
Clock uses SetWindowPos to make its window a topmost window when Stay
On Top is checked in the system menu and a nontopmost window when Stay On Top is
unchecked. The work is done by CMainWindow::SetTopMostState, which is
called by OnSysCommand. When Stay On Top is checked, Clock is visible on
the screen at all times, even if it's running in the background and it overlaps
the application running in the foreground.
extended window style bit. WS_EX_TOPMOST makes a window a topmost window. You
can create a topmost frame window by including a WS_EX_TOPMOST flag in the call
to Create, like this:
Create (NULL, _T ("MyWindow"), WS_OVERLAPPEDWINDOW, rectDefault, NULL, NULL, WS_EX_TOPMOST);[/code] |
calling SetWindowPos with a &wndTopMost parameter, as shown
here:
SetWindowPos (&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE ¦ SWP_NOSIZE);[/code] |
SetWindowPos with the first parameter equal to &wndNoTopMost
rather than &wndTopMost.
Clock uses SetWindowPos to make its window a topmost window when Stay
On Top is checked in the system menu and a nontopmost window when Stay On Top is
unchecked. The work is done by CMainWindow::SetTopMostState, which is
called by OnSysCommand. When Stay On Top is checked, Clock is visible on
the screen at all times, even if it's running in the background and it overlaps
the application running in the foreground.
相关文章推荐
- MFC Windows 程序设计->hello world
- MFC Windows 程序设计->GetDeviceCaps
- MFC Windows 程序设计->WinMain 简单Windows程序 命令行编译
- MFC Windows 程序设计->取消对GDI对象的选定
- MFC Windows 程序设计->捕获鼠标
- C语言Windows程序设计->第三天->属于自己的窗口
- MFC Windows 程序设计->键盘加速键
- MFC Windows 程序设计->消息反射
- MFC Windows 程序设计->实现客户区拖动
- windows学习笔记3——窗口和消息<一>
- C语言Windows程序设计->第四天->详解我的窗口(上)
- 3dsmax 二次开发里面加入对话框时提示:WINDOWS.H already included. MFC apps must not #include <windows.h>
- #error WINDOWS.H already included. MFC apps must not #include <windows.h>
- MFC Windows 程序设计 第二章 在窗口中绘图
- WINDOWS.H already included. MFC apps must not #include <windows.h>
- MFC: 右键弹出菜单-->选取菜单弹出窗口
- VS2013 MFC Windows 程序设计之窗口滚动条 他对,坚持,坚持,就对了。
- [MFC] 基于多进程的窗口程序设计 & 窗口分离与合并(仿chrome的窗口分离效果)
- <<windows程序设计>> Charles Petzold VS 王艳平
- C语言Windows程序设计->第四天->详解我的窗口(中)