unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Label1: TLabel;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
var
h,h_1:hwnd;
begin
h:=FindWindow('WindowsForms10.Window.8.app.0.297b065','QQ2009 Preview');
if  h<>0  then
label1.Caption:='飞信在运行'
else
label1.Caption:='飞信不在运行'end;end.
我想实现在一个窗体上监视多个程序运行 例如 我再添加几个label控件我希望QQ显示在lable 2 上面 如果实现啊

解决方案 »

  1.   


    procedure TForm1.button1click(Sender: TObject);
    var
      h,h_1:hwnd;
    begin
      h:=FindWindow('WindowsForms10.Window.8.app.0.297b065','QQ2009 Preview');
      if  h<>0  then
      label2.Caption:='飞信在运行'
    else
    label1.Caption:='飞信不在运行'end;end.
    在窗体添加一个Tbutton,在click事件写代码!
    不知道是否误解楼主意思!?
      

  2.   

    procedure TForm1.FormCreate(Sender: TObject);
    var
    h,h_1:hwnd;
    begin
    h:=FindWindow('WindowsForms10.Window.8.app.0.297b065','QQ2009 Preview');
    if  h<>0  then
    label1.Caption:='飞信在运行'
    else
    label1.Caption:='飞信不在运行'// QQ的
    h:=FindWindow('WindowsForms10.Window.8.app.0.297b065','QQ2009 Preview');
    if  h<>0  then
    label2.Caption:='QQ在运行'
    else
    label2.Caption:='QQ不在运行'end;
    順便說下QQ這樣做會有很多問題。QQ要從它的類出發。因為QQ的窗體名稱是不斷在變的。