已知某个程序如AAA.exe,怎么知道他现在是不是在运行?要求不用FindWindow().

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/3263/3263926.xml?temp=.4074671
      

  2.   

    哪你可以遍历所有的进程 然后取出其exe名称 跟aaa.exe比较 OK..提问之前 请先搜索 这个问题 问了很多遍了
      

  3.   

    楼上的说的是,可是我搜过了,就搜到一楼给的那个帖了,调试时,说那些API的类型没定义,加了
    shellApi 也不顶事呀.
      

  4.   

    uses tlhelp32;
    procedure checkpro;              
    var
      ippe:tprocessentry32;
      sshandle:thandle;
      found:boolean;
    begin
      sshandle:=createtoolhelp32snapshot(TH32CS_SNAPPROCESS,0);
      found:=process32first(sshandle,ippe);
      while found do
      begin
        if ansicomparetext(extractfilename(ippe.szExeFile),‘进程名字')=0 then
        begin
          showmessage('该进程存在!');
          break;
        end;
        found:=process32next(sshandle,ippe);
      end;
    end;
      

  5.   

    Var
      hMutex : hWnd;
      Ret : integer;
    begin
      Application.Initialize;
      hMutex:=CreateMutex(NIL,False,'sysfilm');
      Ret:=GetLastError;
      IF Ret<>ERROR_ALREADY_EXISTS then
      BEGIN
          showmessage('没运行');
      end
      else
        showmessage('已经运行了');
    end;
      

  6.   

    回复人: lemon_wei(soft_fans) ( ) 信誉:99 
    楼上的说的是,可是我搜过了,就搜到一楼给的那个帖了,调试时,说那些API的类型没定义,加了
    shellApi 也不顶事呀.
      

  7.   

    提示哪个API未定义就在帮助里面查一下此API,  帮助中写着应该use哪个单元