网站首页  词典首页

请输入您要查询的函数:

 

术语 setwindowpos
释义 SetWindowPos
语法:
BOOL SetWindowPos( HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags
);
SetWindowPos函数
改变大小,位置和Z儿童,弹出,或顶层窗口秩序。这些窗口是按照其出现在屏幕上。最上面的窗口接收的最高级别,是在Z顺序的第一个窗口。
参数
hWnd
[in]一个窗口句柄。
hWndInsertAfter
[in]的句柄窗口之前在Z顺序定位窗口。此参数必须是一个窗口句柄或下列值之一。
HWND_BOTTOM
把窗口的Z顺序的底部。如果hWnd参数确定了最顶层窗口,窗口失去了最顶层的地位,是在所有其他窗口的底部。
HWND_NOTOPMOST
把窗口放在高于一切的非最顶层窗口(即背后最顶层窗口)。此标志无效如果窗口已经是一个非最顶层窗口。
HWND_TOP
把窗口的Z序的顶部。
HWND_TOPMOST
把窗口放在上述所有非顶层窗口。窗口保持其最顶端的位置,即使它被停用。
有关如何使用此参数,请参阅下面的备注部分。
X
[in]指定的窗口左侧的新岗位上,在客户端坐标。
y
[in]指定窗口顶部的新位置,在客户端坐标。
国泰航空
[in]指定窗口的新宽度,以像素为单位。
赛扬
[in]指定窗口的新高度,以像素为单位。
uFlags
[in]指定窗口大小和位置标志。此参数可以是下列值的组合。
SWP_ASYNCWINDOWPOS
如果调用线程和线程拥有的窗口连接到不同的输入队列,系统职位的请求的线程拥有的窗口。这可以防止阻止其执行调用线程,而其他线程处理请求。
SWP_DEFERERASE
防止信息的WM_SYNCPAINT一代。
SWP_DRAWFRAME
绘制一个框(定义在窗口的类的描述)周围的窗口。
SWP_FRAMECHANGED
适用于新的框架样式设置使用SetWindowLong函数。发送WM_NCCALCSIZE消息窗口,即使窗口的大小没有改变。如果此标志没有被指定,WM_NCCALCSIZE只有当发送窗口的大小被改变。
SWP_HIDEWINDOW
隐藏窗口。
SWP_NOACTIVATE
不激活的窗口。如果此标志没有设置,窗口被激活,并移动到顶部无论是最顶层或非顶层组(对hWndInsertAfter参数设置而定)。
SWP_NOCOPYBITS
丢弃的客户区的全部内容。如果此标志没有被指定的客户区的有效内容被保存和复制到后回客户区窗口大小或重新定位。
SWP_NOMOVE
保留当前位置(忽略X和Y参数)。
SWP_NOOWNERZORDER
不改变所有者窗口的Z顺序中的位置。
SWP_NOREDRAW
不重绘的变化。如果设置此标志,没有发生任何形式的油漆。这适用于客户区,非工作区(包括标题栏和滚动条),和任何一个窗口的结果发现父窗口的一部分被移动。当此标志设置,应用程序必须明确失效或重绘的窗口和父窗口需要重画的任何部分。
SWP_NOREPOSITION
相同SWP_NOOWNERZORDER标志。
SWP_NOSENDCHANGING
阻止接收WM_WINDOWPOSCHANGING消息的窗口。
SWP_NOSIZE
保留当前大小(忽略了国泰航空和cy参数)。
SWP_NOZORDER
保留当前Z顺序(忽略hWndInsertAfter参数)。
SWP_SHOWWINDOW
显示窗口。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
作为Vista的一部分,重新架构,所有的服务都移出到会话0交互式桌面上。 HWND和窗口管理器操作的唯一有效内会议和跨会话企图操纵的HWND将失败。有关更多信息,请参见会话0隔离。
如果SWP_SHOWWINDOW或SWP_HIDEWINDOW标志设置,窗口不能被移动或大小。
如果您已更改特定的窗口数据使用SetWindowLong函数,您必须要求改变SetWindowPos生效。为uFlags使用下列组合:SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED。
一个窗口也可通过设置hWndInsertAfter参数HWND_TOPMOST并确保SWP_NOZORDER标志未设置,或设置一个窗口的Z顺序中的位置,使之高于任何现有的最上面的窗口是一个顶层窗口。当一个非最顶层窗口是由最顶端,其拥有的窗户也最顶端。其所有者,但是,没有改变。
如果既不SWP_NOACTIVATE也不SWP_NOZORDER标志被指定(即,当应用程序要求一个窗口被激活的同时,其在Z顺序改变位置),在hWndInsertAfter指定的值是用在下列情况下才。
无论是HWND_TOPMOST也不HWND_NOTOPMOST标志在hWndInsertAfter指定。
由hWnd确定窗口不是活动窗口。
应用程序不能激活也没有把它的Z顺序最不活动的窗口。应用程序可以改变一个激活的窗口在Z顺序不受限制的地位,或者它可以激活一个窗口,然后将其移动到了最顶层或非顶层窗口之上。
如果一个顶层窗口重新定位到Z顺序或在任何非顶层窗口,它不再是最顶层的底部(HWND_BOTTOM)。当一个最顶层窗口是由非顶层,其业主和其拥有的窗户也非最顶层窗口。
一个非最顶层窗口可以拥有一个最顶层窗口,但也不会发生逆转。任何窗口(例如,一个对话框),由最顶层窗口本身拥有了最顶层窗口,以确保所有国有窗口逗留超过其所有者。
如果应用程序是不是在前台,并应在前台,它必须调用SetForegroundWindow函数。
若要使用SetWindowPos带来一个窗口顶端,拥有的进程必须有窗口SetForegroundWindow权限。
例如
有关示例,请参阅初始化一个对话框。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为Unicode版本。
参见
视窗概述,MoveWindow,SetActiveWindow,SetForegroundWindow
==英文原文==SetWindowPos Function
Changes the size, position, and Z order of a child, pop-up, or top-level window. These 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.
Syntax
BOOL SetWindowPos( HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags
);
Parameters
hWnd
[in] A handle to the window.
hWndInsertAfter
[in] A handle to the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values.
HWND_BOTTOM
Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
HWND_NOTOPMOST
Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
HWND_TOP
Places the window at the top of the Z order.
HWND_TOPMOST
Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
For more information about how this parameter is used, see the following Remarks section.
X
[in] Specifies the new position of the left side of the window, in client coordinates.
Y
[in] Specifies the new position of the top of the window, in client coordinates.
cx
[in] Specifies the new width of the window, in pixels.
cy
[in] Specifies the new height of the window, in pixels.
uFlags
[in] Specifies the window sizing and positioning flags. This parameter can be a combination of the following values.
SWP_ASYNCWINDOWPOS
If the calling thread and the thread that owns the window are attached to different input queues, the system posts the request to the thread that owns the window. This prevents the calling thread from blocking its execution while other threads process the request.
SWP_DEFERERASE
Prevents generation of the WM_SYNCPAINT message.
SWP_DRAWFRAME
Draws a frame (defined in the window's class description) around the window.
SWP_FRAMECHANGED
Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
SWP_HIDEWINDOW
Hides the window.
SWP_NOACTIVATE
Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
SWP_NOCOPYBITS
Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
SWP_NOMOVE
Retains the current position (ignores X and Y parameters).
SWP_NOOWNERZORDER
Does not change the owner window's position in the Z order.
SWP_NOREDRAW
Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
SWP_NOREPOSITION
Same as the SWP_NOOWNERZORDER flag.
SWP_NOSENDCHANGING
Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
SWP_NOSIZE
Retains the current size (ignores the cx and cy parameters).
SWP_NOZORDER
Retains the current Z order (ignores the hWndInsertAfter parameter).
SWP_SHOWWINDOW
Displays the window.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
As part of the Vista re-architecture, all services were moved off the interactive desktop into Session 0. hwnd and window manager operations are only effective inside a session and cross-session attempts to manipulate the hwnd will fail. For more information, see Session 0 Isolation .
If the SWP_SHOWWINDOW or SWP_HIDEWINDOW flag is set, the window cannot be moved or sized.
If you have changed certain window data using SetWindowLong, you must call SetWindowPos for the changes to take effect. Use the following combination for uFlags: SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED.
A window can be made a topmost window either by setting the hWndInsertAfter parameter to HWND_TOPMOST and ensuring that the SWP_NOZORDER flag is not set, or by setting a window's position in the Z order so that it is above any existing topmost windows. When a non-topmost window is made topmost, its owned windows are also made topmost. Its owners, however, are not changed.
If neither the SWP_NOACTIVATE nor SWP_NOZORDER flag is specified (that is, when the application requests that a window be simultaneously activated and its position in the Z order changed), the value specified in hWndInsertAfter is used only in the following circumstances.
Neither the HWND_TOPMOST nor HWND_NOTOPMOST flag is specified in hWndInsertAfter.
The window identified by hWnd is not the active window.
An application cannot activate an inactive window without also bringing it to the top of the Z order. Applications can change an activated window's position in the Z order without restrictions, or it can activate a window and then move it to the top of the topmost or non-topmost windows.
If a topmost window is repositioned to the bottom (HWND_BOTTOM) of the Z order or after any non-topmost window, it is no longer topmost. When a topmost window is made non-topmost, its owners and its owned windows are also made non-topmost windows.
A non-topmost window can own a topmost window, but the reverse cannot occur. Any window (for example, a dialog box) owned by a topmost window is itself made a topmost window, to ensure that all owned windows stay above their owner.
If an application is not in the foreground, and should be in the foreground, it must call the SetForegroundWindow function.
To use SetWindowPos to bring a window to the top, the process that owns the window must have SetForegroundWindow permission.
Example
For an example, see Initializing a Dialog Box .
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
UnicodeImplemented as Unicode version.
See Also
Windows Overview , MoveWindow , SetActiveWindow , SetForegroundWindow
==原始网址==http://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:26:06