milo

c++

常用链接

统计

最新评论

设置或取消窗口顶层属性


设置窗口顶层:
SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | WS_EX_TOPMOST);
SetWindowPos(hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
If you have changed certain window data using SetWindowLong, you must call SetWindowPos to have the changes take effect.
取消窗口顶层:
SetWindowPos(hWnd,HWND_NOTOPMOST ,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);

The SetWindowPos 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,             // handle to window
  HWND hWndInsertAfter,  // placement-order handle
  int X,                 // horizontal position
  int Y,                 // vertical position
  int cx,                // width
  int cy,                // height
  UINT uFlags            // window-positioning flags
);

posted on 2008-11-09 11:17 milo 阅读(1211) 评论(0)  编辑 收藏 引用