http://blog.163.com/yuanliaofan@126/blog/static/1730690722012534428814/
delphi SetWindowPos改变窗体位置和状态
2012-06-03 16:04:28| 分类: |举报|字号
delphi SetWindowPos改变窗体位置和状态
//举例:procedure TForm1.Button1Click(Sender: TObject);beginSetWindowPos(Handle, HWND_TOPMOST, 0,0, 100,200, SWP_SHOWWINDOW);end;
//声明:
SetWindowPos(hWnd: HWND; {窗口句柄}hWndInsertAfter: HWND; {窗口的 Z 顺序}X, Y: Integer; {位置}cx, cy: Integer; {大小}uFlags: UINT {选项}): BOOL;//hWndInsertAfter 参数可选值:HWND_TOP = 0; {在前面}HWND_BOTTOM = 1; {在后面}HWND_TOPMOST = HWND(-1); {在前面, 位于任何顶部窗口的前面}HWND_NOTOPMOST = HWND(-2); {在前面, 位于其他顶部窗口的后面}//uFlags 参数可选值:SWP_NOSIZE = 1; {忽略 cx、cy, 保持大小}SWP_NOMOVE = 2; {忽略 X、Y, 不改变位置}SWP_NOZORDER = 4; {忽略 hWndInsertAfter, 保持 Z 顺序}SWP_NOREDRAW = 8; {不重绘}SWP_NOACTIVATE = $10; {不激活}SWP_FRAMECHANGED = $20; {强制发送 WM_NCCALCSIZE 消息, 一般只是在改变大小时才发送此消息}SWP_SHOWWINDOW = $40; {显示窗口}SWP_HIDEWINDOW = $80; {隐藏窗口}SWP_NOCOPYBITS = $100; {丢弃客户区}SWP_NOOWNERZORDER = $200; {忽略 hWndInsertAfter, 不改变 Z 序列的所有者}SWP_NOSENDCHANGING = $400; {不发出 WM_WINDOWPOSCHANGING 消息}SWP_DRAWFRAME = SWP_FRAMECHANGED; {画边框}SWP_NOREPOSITION = SWP_NOOWNERZORDER;{}SWP_DEFERERASE = $2000; {防止产生 WM_SYNCPAINT 消息}SWP_ASYNCWINDOWPOS = $4000; {若调用进程不拥有窗口, 系统会向拥有窗口的线程发出需求}//举例:procedure TForm1.Button1Click(Sender: TObject);beginSetWindowPos(Handle, HWND_TOPMOST, 0,0, 100,200, SWP_SHOWWINDOW);end;