天软金融分析.NET函数大全 > TSL函数 > 资源访问函数 > 进程相关函数

SysexecDeletepipe    

简述
删除指定进程的管道。参数缺省时,删除默认管道。
指定进程是指在通过sysexecnewpipe创建管道后,sysexec的进程使用的管道。如果不重复使用sysexecnewpipe创建也不删除,这个管道可以被复用,如果每次执行前都新建管道,则可以为不同的进程使用不同的管道。
定义
Sysexecdeletepipe([ProcessHandle]):Boolean
参数
名称类型说明
ProcessHandle数值,可选参数,进程句柄。
返回Boolean布尔值,删除失败时返回0,删除成功时返回1
  • 范例

    //创建读写管道
    SysexecNewpipe(0);
    path:="D:\\Program Files\\Analyse.NET\\TSL.exe";
    //非阻塞执行,返回进程句柄
    hand:= SysExec(path,"tsl",nil,false,code);
    //获取SysExec进程所在管道的输出内容
    t1:= "";
    while t1="" do
    begin
      t1:= SysexecReadpipe(hand);
    end
    deRet:= SysexecDeletepipe(hand);
    //删除成功,尝试向指定进程所在管道写入内容
    if deRet then
    begin
      try
        SysexecWritepipe(hand," datetostr(20221130T)\r\n");
        return false;
      except
        //写入失败,管道删除成功
        return true;
      end;
    end
    SysTerminate(code, hand);//终止进程
    return false;

    //结果:
    参考
    SysExec、SysexecNewpipeSysexecdeletepipeSysexecreadpipeSysExecWritePipe 
相关