SetWindowPos
其中参数的窗体句柄设为想要居顶端的窗体句柄var
  h:Integer;
  p:Tpoint;
begin
  GetCursorPos(p);
  h:=windowfrompoint(p);
  SetWindowPosh,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE);
end;

解决方案 »

  1.   

    同意楼上的,就是用API: SetWindowPos
      

  2.   

    如果想让窗口一直在顶端,可以将窗口的属性FormStyle设成fsStayOnTop就
    可以了。如果只是临时将窗口带到最顶端,可以用
    SetForegroundWindow(Handle);
    BringWindowToTop(Handle);
      

  3.   

    下面的代码是从我的系统中拷给你的。呵呵,保证有效。
        SetSysFocus(Self.Handle);
        ShowWindow(Self.Handle, sw_normal);
        Handled := True;函数原型为:
    function SetSysFocus(hwnd: integer): integer; //ÉèÖÃij´°¿ÚΪ»î¶¯´°¿Ú
    var
      hOtherWin, OtherTHreadID, hFocusWin: integer;
    begin  hOtherWin := GetForegroundWindow;
      OtherThreadID := GetWindowThreadProcessID(hOtherWin, nil);
      if AttachThreadInput(GetcurrentThreadID, OtherThreadID, True) then
      begin
        hFocusWin := GetFocus;
        result := SetFocus(hwnd);
        //SendMessage(hwnd,WM_COPY,0,0);
        if hFocusWin <> 0 then
        try
          //SendMessage(GetFocus,WM_COPY,0,0);
        finally
          AttachThreadInput(GetCurrentTHreadID, OtherTHreadID, False);
        end;
      end
      else
        result := SetFocus(hwnd);
    end;
      

  4.   

    SetSysFocus(Self.Handle);
        ShowWindow(Self.Handle, sw_normal);
        Handled := True;这三句我是写在application.onmessage事件中的,所以有handled变量
      

  5.   

    还差一点,快成了。
    我用
    SetForegroundWindow(Handle);
    BringWindowToTop(Handle);
    窗口图标只是闪动提示我,它并没有显示在最前面。
      

  6.   

    BringWindowToTop(Handle);
    SetForegroundWindow(Handle);
    这样再试试看。
      

  7.   

    shangshang(大雪有痕) 的方法是正确的。
      

  8.   

    我有个OCX,如果你要就发短消息给我。
    哈哈,看到我了吧。