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.