unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,tlhelp32, StdCtrls; type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
function qqExist:boolean;implementation {$R *.dfm}
function SQLExist:boolean;
var ProcessList:Thandle;
pe:TPROCESSENTRY32;
begin
ProcessList:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
pe.dwSize:=sizeof(TPROCESSENTRY32);
try
if process32first(ProcessList,pe) then
if strcomp(pe.szExeFile, 'QQ.exe ')=0 then
begin
sqlexist:=False;
exit;
end
else
while process32next(processlist,pe) do
if strcomp(pe.szExeFile, 'QQ.exe ') <> 0 then
sqlexist:=true
else
begin
sqlexist:=false;
exit;
end;
finally
closehandle(processlist);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if sqlexist then
label1.Caption:= 'qq正在运行. '
else
label1.Caption:= 'qq不在运行! ';
end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,tlhelp32, StdCtrls; type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
function qqExist:boolean;implementation {$R *.dfm}
function SQLExist:boolean;
var ProcessList:Thandle;
pe:TPROCESSENTRY32;
begin
ProcessList:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
pe.dwSize:=sizeof(TPROCESSENTRY32);
try
if process32first(ProcessList,pe) then
if strcomp(pe.szExeFile, 'QQ.exe ')=0 then
begin
sqlexist:=False;
exit;
end
else
while process32next(processlist,pe) do
if strcomp(pe.szExeFile, 'QQ.exe ') <> 0 then
sqlexist:=true
else
begin
sqlexist:=false;
exit;
end;
finally
closehandle(processlist);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if sqlexist then
label1.Caption:= 'qq正在运行. '
else
label1.Caption:= 'qq不在运行! ';
end;end.
解决方案 »
- 如何读取多条数据到一个EDIT.TEXT中
- 如何对表中数据四舍五入?
- Delphi7中,server程序想发一个广播(包含自己的IP&Port),client程序收到广播后既可以建立连接.哪一个控件可以实现?
- 今天拿回签合同交的抵押金了,散分~
- 怎样将这个C++bulider代码换成DELPHI 的?
- 请问:如何把按钮放进ExpressBar的dxSideBar中?请用过的高手指教
- 在ServerSocket中如何向指定的客户连接发送信息?
- 采用paradox数据库,在用installshield打包时,在objects/merge modules中应该选择哪几项才有加载Idpdx32.dll?
- DELPHI中xml如何转换
- 这个问题最菜
- 动态创建一个adoconnection连接???
- dephi中怎样把单个控件的透明度改变
sqlexist:=true //应该是False
else
begin
sqlexist:=false; //应该是true