有谁知道如何让窗体最小化后在任务栏上闪烁(类似MSN有消息到来的效果)?以及如果判断和控制窗口最大化和最小化。
谢谢先。

解决方案 »

  1.   

    FlashWindow(Application.Handle, true):
      

  2.   

    闪烁可以用flashwindow()
    判断最大最小化可以在onresize事件里判断windowstate,1为最小,2 为最大,0为normal
      

  3.   

    只能截获最小化消息:
    type      procedure MyMessage(var msg:Tmsg);message wm_syscommand;...
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      FlashWindow(Application.Handle,true);
    end;procedure TForm1.MyMessage(var msg: Tmsg);
    begin
      inherited;
      if msg.message=61472 then  Timer1.Enabled:=true else Timer1.Enabled:=false;
    end;procedure TForm1.FormPaint(Sender: TObject);
    begin
      if self.WindowState=wsMinimized then Timer1.Enabled:=true else Timer1.Enabled:=false;
    end;
      

  4.   

    好像用
    BOOL SetForegroundWindow(    HWND hWnd  // handle of window to bring to foreground
       );更好一些不用判断是否是最小化的,msn在接收到message时,调用setforegroundwindow(此时,如果你的应用在screen的最上面就什么都不做,否则就会努力把自己的form调到上面来,这时窗口就是闪烁的)
      

  5.   

    截WM_SYSCOMMAND消息
    procedure TGZMForm.WMSysCommand(var Msg: TWMSysCommand);
    begin
      if Msg.CmdType = SC_MINIMIZE then
        Application.Minimize
      else
        inherited;
    end;
      

  6.   

    IsIconic(Application.Handle)判断是否是最小话状态!