面对现实,超越自己
逆水行舟,不进则退
posts - 269,comments - 32,trackbacks - 0
来源:
http://portableapps.com/node/12561
下载
http://zer0dev.com/dld/download.php?id=27

头文件使用:
1. !include "ProcFunc.nsh"
2. 可使用范围:$var为返回值
[Section|Function]
${ProcFunction} "参数1" "参数2" "..." $var
[SectionEnd|FunctionEnd]

${ProcessExists} "[process]"
    "[process]"            ; Name or PID

    Use with a LogicLib conditional command like If or Unless.
    Evaluates to true if the process exists or false if it does not or
    the CreateToolhelp32Snapshot fails.

${GetProcessPID} "[process]" $var
    "[process]"            ; Name or PID
   
    $var(output)          ; -2 - CreateToolhelp32Snapshot failed
                               ;  0 - process does not exist
                               ; >0 - PID

${GetProcessPath} "[process]" $var
    "[process]"            ; Name or PID
   
    $var(output)          ; -2 - CreateToolhelp32Snapshot failed
                               ; -1 - OpenProcess failed
                               ;  0 - process does not exist
                               ; Or path to process

${GetProcessParent} "[process]" $var
    "[process]"            ; Name or PID

    $var(output)          ; -2 - CreateToolhelp32Snapshot failed
                               ;  0 - process does not exist
                               ; Or PPID

${GetProcessName} "[PID]" $var
    "[PID]"                 ; PID

    $var(output)         ; -2 - CreateToolhelp32Snapshot failed
                              ;  0 - process does not exist
                              ; Or process name

${EnumProcessPaths} "Function" $var
    "Function"            ; Callback function
    $var(output)         ; -2 - EnumProcesses failed
                              ;  1 - success

    Function "Function"
        Pop $var1        ; matching path string
        Pop $var2        ; matching process PID
        ...user commands
        Push [1/0]       ; must return 1 on the stack to continue
                             ; must return some value or corrupt the stack
                             ; DO NOT save data in $0-$9
    FunctionEnd

${ProcessWait} "[process]" "[timeout]" $var
    "[process]"          ; Name
    "[timeout]"          ; -1 - do not timeout
                             ; >0 - timeout in milliseconds

    $var(output)        ; -2 - CreateToolhelp32Snapshot failed
                             ; -1 - operation timed out
                             ; Or PID

${ProcessWait2} "[process]" "[timeout]" $var
    "[process]"          ; Name
    "[timeout]"          ; -1 - do not timeout
                             ; >0 - timeout in milliseconds

    $var(output)        ; -1 - operation timed out
                             ; Or PID

${ProcessWaitClose} "[process]" "[timeout]" $var
    "[process]"          ; Name
    "[timeout]"          ; -1 - do not timeout
                             ; >0 - timeout in milliseconds

    $var(output)        ; -1 - operation timed out
                             ;  0 - process does not exist
                             ; Or PID of ended process

${CloseProcess} "[process]" $var
    "[process]"          ; Name or PID

    $var(output)        ; 0 - process does not exist
                             ; Or PID of ended process

${TerminateProcess} "[process]" $var
    "[process]"          ; Name or PID

    $var(output)        ; -1 - operation failed
                             ;  0 - process does not exist
                             ; Or PID of ended process

${Execute} "[command]" "[working_dir]" $var
    "[command]"        ; '"X:\path\to\prog.exe" arg1 arg2 "arg3 with space"'
    "[working_dir]"     ; Working directory ("X:\path\to\dir") or nothing ("")

    $var(output)        ; 0 - failed to create process
                             ; Or PID
*/

本文转自:http://www.dreams8.com/forum.php?mod=viewthread&tid=17067&fromuid=1
posted on 2012-10-18 14:09 王海光 阅读(821) 评论(0)  编辑 收藏 引用 所属分类: NSIS

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理