如果判断是否已创建(未必可见)用 if assigned(Form1) 来判断 如果已创建,判断是否显示用if form1.showing 来判断
var handle:hwnd; handle:= findwindow(nil,wintext);//查找纸牌程序 if handle<>0 then showmessage('纸牌程序已经运行';) end;
var handle:hwnd; handle:= findwindow(nil,'你的窗口名称'); if handle<>0 then showmessage('已经运行';) end;
procedure TForm1.Button2Click(Sender: TObject); begin if assigned(form1) then showmessage('alreaday created instance'); if form1.Showing then showmessage('alrady show'); end; end.
如果已创建,判断是否显示用if form1.showing 来判断
handle:hwnd;
handle:= findwindow(nil,wintext);//查找纸牌程序
if handle<>0 then
showmessage('纸牌程序已经运行';)
end;
handle:hwnd;
handle:= findwindow(nil,'你的窗口名称');
if handle<>0 then
showmessage('已经运行';)
end;
begin
if assigned(form1) then showmessage('alreaday created instance');
if form1.Showing then showmessage('alrady show');
end;
end.