我想创建这样的一个窗体:这个窗体始终在桌面的最顶部,也即浮动在最上面.且此窗体一直不激活,即使点击后,也会立刻回到原来焦点的位置,设置整窗体在整个过程中为不激活的函数应该为setwindowlong,但我不知道怎么用  .
  

解决方案 »

  1.   

    form的 OnDeactivate 事件
    SetWindowPos(Handle, HWND_TOPMOST, Left,Top, Width,
                 Height, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
    form 的OnActive:SetWindowPos(Handle, HWND_NOTOPMOST, Left, Top, Width,
                 Height, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE); 
      

  2.   

    skin2003(freedomhua) :不要乱发广告。
      

  3.   

    var
      Form1: TForm1;
      oleft:Integer;
      otop:Integer;
      owidth:Integer;
      oheight:Integer;
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    //记录原始位置     全局变量
    oleft:=Left;
    otop:=Top;
    owidth:=width;
    oheight:=height;
    end;end;
    procedure TForm1.windowsposchange(var Msg:TWMWINDOWPOSCHANGING);
    begin // 恢复院士位置尺寸Msg.WindowPos.x:=oleft;
    Msg.WindowPos.y:=otop;Msg.WindowPos.cx :=owidth;
    Msg.WindowPos.cy:=oheight;inherited;end;