我用下面的代码为什么没有效果?var
  pt: TPoint;
  h: HWND;
  rc: TRect;
begin
  GetCursorPos(pt);
  h := WindowFromPoint(pt);
  h := GetNextWindow(h, GW_HWNDPREV);
  GetWindowRect(h, rc);
  SetWindowPos(Self.Handle, h, rc.Left, rc.Top, 0, 0, SWP_NOSIZE);
end;

解决方案 »

  1.   

    form1.formStyle := fsStayOnTop;
    这样就可以了 
      

  2.   

         SetWindowPos(ProForm.Handle,HWND_TOPMOST, 0,0,0,0,
            SWP_NOACTIVATE + SWP_NOMOVE + SWP_NOSIZE + SWP_SHOWWINDOW);
      

  3.   

    h := GetNextWindow(h, GW_HWNDPREV)
    啥意图?置顶:  form1.formStyle := fsStayOnTop;
     
    然后:
    var 
      pt: TPoint; 
      h: HWND; 
      rc: TRect; 
    begin
      GetCursorPos(pt);
      h := WindowFromPoint(pt);
      //h := GetNextWindow(h, GW_HWNDPREV);
      if h = Self.Handle then Exit;
      GetWindowRect(h, rc);
      SetWindowPos(Self.Handle, 0, rc.Left, rc.Top, rc.Right - rc.Left,rc.Bottom - rc.Top, SWP_SHOWWINDOW);
    end
      

  4.   

    用SetParent可以做到Windows.SetParent(Self.Handle, ProForm.Handle)
      

  5.   

    对,用Windows.SetParent即可,重新设置父句柄.