用delphi代码,怎么能得到进程中是否运行有某个应用程序的名字呢?
例如我想知道进程中是否运行“RealTime.exe”这个进程,如果没有则启动这个应用程序!

解决方案 »

  1.   

    这里有个源代码:http://www.delphifans.com/SoftView/SoftView_1939.html
    你看看:
      

  2.   

    uses tlhelp32;--------------
    var
    lppe:tprocessentry32;
    sshandle:thandle;
    found:boolean;
    begin
    sshandle:=createtoolhelp32snapshot(th32cs_snapail,0);
    found:=process32first(sshandle,lppe);
    while found do
    begin
      //进行你的处理其中lppe.szExefile就是程序名。
      found:=proccess32next(sshandle,lppe);
    end;
    end;//线程用Thread32First,Thread32Next
    //模块用Module32First,Module32Next
    //堆用Heap32First,Heap32Next
    //可执行文件用process32first