MoveWindow和setwindowpos的区别
来源:互联网 发布:js vr 插件 编辑:程序博客网 时间:2024/06/08 13:33
This function changes the position and dimensions of the specified window. For a top-level window, the position and dimensions are relative to the upper-left corner of the screen. For a child window, they are relative to the upper-left corner of the parent window's client area.
BOOL MoveWindow( HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint );
MoveWindow sends WM_WINDOWPOSCHANGED, WM_MOVE, WM_SIZE, and WM_NCCALCSIZE messages to the window. (这里很重要,说明MoveWindow函数内部不做真实的窗口处理,而是发送了一组消息,让其他函数进行处理,其实这个函数就是SetWindowPos,我们可以继续往下看)
2、SetWindowPos
This 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 );
SetWindowPos always causes a WM_WINDOWPOSCHANGED message to be sent to the window. The flags passed in this message are exactly the same as those passed into the function. No other messages are sent by this function. (SetWindowPos包含了z-order的设置,其功能比MoveWindow更为强大,包含了一组设置窗口显示状态的标志。然而,MoveWindow和SetWindowPos更本质的区别是,MoveWindow做了更多额外的事情,发送WM_MOVE, WM_SIZE, and WM_NCCALCSIZE等多种消息给窗口,而SetWindowPos则显的单纯的多,只发送了WM_WINDOWPOSCHANGED消息给窗口)
从上面可以看出MoveWindow和SetWindowPos实现的功能基本是一致的,但还是存在细微的差别,关键的一点是MoveWindow不仅通知窗口进行SetWindowPos操作,而且还发送了一批消息,告知窗口显示改变了,这样窗口就可以在内部进行一些操作。这点对处理ActiveX控件的resize很重要,在ActiveX控件中往往通过WM_SIZE消息处理关联窗口resize的窗口调整,所以在调用方必须使用MoveWindow才能使ActiveX控件实现resize。
- MoveWindow和setwindowpos的区别
- MoveWindow和setwindowpos的区别
- MoveWindow和setwindowpos的区别(转)
- MoveWindow 和 SetWindowPos 的比较
- MoveWindow() SetWindowPos()的区别于联系
- MoveWindow() SetWindowPos()的区别与联系
- MoveWindow SetWindowPos 区别
- SetWindowPos 和 MoveWindow 的用法(转)
- MoveWindow和SetWindowPos之异同!
- MoveWindow与SetWindowPos的异同
- 改变控件的大小和位置(关于MoveWindow()或SetWindowPos())
- 关于窗口操作的函数:MoveWindow、SetWindowPos和DeferWindowPos
- 用CWnd类的函数MoveWindow()或SetWindowPos()可以改变控件的大小和位置
- 用CWnd类的函数MoveWindow()或SetWindowPos()可以改变控件的大小和位置
- SetWindowPos与MoveWindow
- MoveWindow and SetWindowPos
- MoveWindow()或SetWindowPos()
- SetWindowPos and MoveWindow
- Java文件操作:按行读取和写入
- android打印调用关系的方法
- poj 1936 串(字序列匹配,满足贪心性质)复杂度O(n+m)
- opencv支持ffmpeg,pkg-config的使用注意事项
- (基础学习)MySQL体系结构
- MoveWindow和setwindowpos的区别
- XMLHttpRequest对象的属性和方法
- MyEclipse插件介绍与下载
- 线性表-双链表
- 用ci框架遇到的错误一
- Uninstall 7-zip with WindowsUninstaller.Org Removal Tips
- 第九周上机项目3:个人所得税计算器.
- G4Studio行业应用二次快速开发平台简介 支持开源软件
- Linux_fdisk操作SD卡