zoukankan      html  css  js  c++  java
  • Setup Factory 关闭正在运行的程序

    --在全局函数中增加 适用用Setup Factory 9

    function FindAndCloseProcessByName(strName)
      local tblProcesses = Window.EnumerateProcesses(false);
      local bProcessFound = false;
      local nProcessHandle = nil; 
    if Table.Count(tblProcesses) > 0 then
     local strProcessName;
     local nHandle;
     for nHandle,strProcessName in pairs(tblProcesses) do
      if(String.Find(strProcessName,strName,1,false) ~= -1)then
      nProcessHandle = nHandle;
      bProcessFound = true;
      end
     end
    end
    if(bProcessFound and nProcessHandle)then
     Window.Close(nProcessHandle,CLOSEWND_TERMINATE); 
    end
    end

    --调用

    FindAndCloseProcessByName("DMS_Client.exe");
    FindAndCloseProcessByName("DMSAutoUpdate.exe");

    --或者直接调用

    strName = "Lx_Update.exe";
    tblProcesses = Window.EnumerateProcesses(false);
    bProcessFound = false;
    nProcessHandle = nil;
    if(tblProcesses)then
    for nHandle, strProcessName in pairs(tblProcesses) do
      if(String.Find(strProcessName,strName,1,false) ~= -1)then
       nProcessHandle = nHandle;
       bProcessFound = true;
      end
    end
    end

    if(bProcessFound and nProcessHandle)then
    Window.Close(nProcessHandle,CLOSEWND_TERMINATE);
    end

  • 相关阅读:
    广播与服务知识点总结
    Intent和Activity知识点总结
    数据库基础
    Java 中JOptionPane的基本使用方法
    Eclipse 自动补全功能失效解决办法及修改快捷键方法
    hdu 2095 find your present (2)
    sort()
    qsort()
    算法学习——分治算法
    NYOJ——街区最短路径问题
  • 原文地址:https://www.cnblogs.com/liujicai/p/5101054.html
Copyright © 2011-2022 走看看