Windows SDK:What is a top-level window?
来源:互联网 发布:大数据技术与应用就业 编辑:程序博客网 时间:2024/05/16 07:46
原文地址:Here
Q:什么是顶层窗口?
A:顶层窗口是非子窗口的窗口,例如,没有设置WS_CHILD的style。
注意:
1.不像子窗口,顶层窗口可以被显示在屏幕的任意位置;
2.一些定义为顶层窗口是“没有父窗口的窗口”;这正确但会引起混淆:很多人就会认为每一个窗口被CreateWindow(EX)创建时传递了有效的hWndParent参数“就拥有父窗口”,依据此定义它们就不是顶层窗口;实际上hWndParent参数可能或者是父窗口句柄或者是所有者窗口(owner window)句柄;假如hWndParent参数有效并且并未设置WS_CHILD的style,那么我们就创建了一个顶层被所有者窗口(ownered window);
3.一个顶层窗口可以被所有(ownered)也可以不被所有但是他绝不是子窗口(child);我们可以更直接的说顶层窗口可以有所有者(owner)但是决不能有父窗口(parent);
4.顶层窗口可以说或者是overlapped windows(拥有WS_OVERLAPPED style通常应用程序主窗口)或者是popup windows(拥有WS_POPUP style,通常是一些临时窗口想message boxes和dialogs);
5.在CreateWindow(EX)、MoveWindow、SetWindowPos等等类似函数设置窗口时使用的坐标系总是屏幕坐标系(相对于屏幕的坐上角)。
Examples:
code:
// create a top-level window (not owned)HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPED, // WS_CHILD style is not set, so it's a top-level window. CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, // no handle to the owner, so it's not owned. NULL, hInstance, NULL);code:
// create a top-level window (owned)HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPED, // WS_CHILD style is not set, so it's a top-level window CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWndParent, // handle to the owner, so it's an owned window NULL, hInstance, NULL);
See also
Windows SDK: What is a child window?
0 0
- Windows SDK:What is a top-level window?
- What is a TCP window update?
- What is a UUID?
- what is a lawyer
- What Is a Desision?
- What Is A Framework?
- what is a TFT?
- What is a THINKER?
- What is a disagreement
- What is a Closure?
- What is a Region?
- what is a map
- What is a FOURCC?
- What is a Program?
- what is a process?
- What is a FOURCC?
- What is a Project?
- What Is a Portlet
- HTML元素显示与隐藏
- Valid Number
- 配置ssh公钥访问oschina
- Android 4.4 KitKat 支持 u 盘功能
- 求一个序列的全排列
- Windows SDK:What is a top-level window?
- JSONP简单例子
- C++设计模式之中介者模式
- Java中初始化对象的顺序,静态代码块的用法以及Static的用法详解
- 【计算机网络】TCP与UDP的区别
- 日本旅行一些注意事项
- 测试时测试测试时测试测试时测试测试时测试
- 配置ssh公钥访问oschina
- 使用接插件需要注意的问题