• Delphi判断进程是否存在(使用CreateToolhelp32Snapshot)


     
    [html] view plain copy
     
    1. program Project2;  
    2.   
    3. uses  
    4.   windows,TLHelp32;  
    5.   
    6. function FindProcess(AFileName:string):boolean;   
    7. var   
    8.     hSnapshot:THandle;  
    9.     lppe:TProcessEntry32;   
    10.     Found:Boolean;   
    11. begin   
    12.     Result:=False;  
    13.     hSnapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);   
    14.     lppe.dwSize:=SizeOf(TProcessEntry32);   
    15.     Found:=Process32First(hSnapshot,lppe);   
    16. while Found do  
    17. begin   
    18.     if(lppe.szExeFile = AFileName) then Result:=True;   
    19.     Found:=Process32Next(hSnapshot,lppe);   
    20. end;   
    21. end;  
    22.   
    23. begin  
    24.     if FindProcess('QQ.exe') then  
    25.     MessageBox(0, PChar('QQ存在'), PChar('提示'), MB_OK);  
    26. end.  
     
    http://blog.csdn.net/cmdasm/article/details/9961575
  • 相关阅读:
    剧集更新表
    Pyhton资源
    JAVA资源
    012 循环
    011 条件判断
    010 使用list和tuple
    009 字符串和编码
    007 Python基础
    python 内置函数
    python 获取当前运行的类名函数名inspect.stack()[1][3]
  • 原文地址:https://www.cnblogs.com/findumars/p/5789410.html
Copyright © 2020-2023  润新知