zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    剑指offer-栈的压入、弹出序列
    剑指offer-包含min函数的栈
    图-Dijkster最短路径
    剑指offer-顺时针打印矩阵
    二叉树的镜像
    剑指offer-树的子结构
  • 原文地址:https://www.cnblogs.com/findumars/p/5789410.html
Copyright © 2011-2022 走看看