zoukankan      html  css  js  c++  java
  • 检查某个exe文件是否正在运行

    function exe_is_running(const exeName:String) : Boolean;  //exeName:不要扩展名的Exe主文件名   
    var  
      hCurrentWindow:HWnd;   
      szText:array[
    0..254] of char;   
    begin  
      Result :
    = False;   
      hCurrentWindow:
    =Getwindow(Application.Handle,GW_HWNDFIRST);   
      
    while hCurrentWindow <> 0 do  
      begin  
        
    if Getwindowtext(hCurrentWindow,@sztext,255)>0 then  
        begin  
           
    if LowerCase(pchar(@sztext))=LowerCase(exeName) then  
           begin  
             Result :
    = true;   
             Exit;   
           end;   
        end;   
        hCurrentWindow:
    =Getwindow(hCurrentwindow,GW_HWndNext);   
      end;   
    end;   

    用法:
    如我们要判断'Live.exe'程序是否正在运行/是否已经启动
    if exe_is_running(Live) then
      ....
    else
      ....

  • 相关阅读:
    消除QQ表情小游戏
    图片排序
    自定义字体
    随机图片滚动
    生成500个0-1000的随机数&&数组查找—小练习
    文字搬运
    查找 替换
    BeginInvoke和EndInvoke方法
    MVC HtmlHelper用法大全
    30分钟LINQ教程 【转载】
  • 原文地址:https://www.cnblogs.com/taobataoma/p/856401.html
Copyright © 2011-2022 走看看