在用户切换应用程序的时候,如何我才能知道我的程序获得了焦点??这时触发的是那个事件??

解决方案 »

  1.   

    procedure WndProc(var Msg: TMessage); override;//重载procedure TForm1.WndProc(var Msg: TMessage);
    begin
      if Msg.Msg = WM_ACTIVATE then
      begin
        Case Msg.WParamLo of
          WA_ACTIVE, WA_CLICKACTIVE:
          begin
            //触发
          end;
        end;
      end;
      inherited WndProc(Msg);
    end;
      

  2.   

    form的OnActivate??我写了东西,可是无效啊,只在启动程序的时候触发了一次
    :(
      

  3.   

    感谢 ehom(?!)  成功:D