捐赠 | 广告 | 注册 | 发布 | 上传 | 关于我们    
  粤ICP备10103342号-1 DELPHI盒子 | 盒子文章 | 盒子问答悬赏 | 最新更新 | 盒子检索 | 下载中心 | 高级搜索    
  精品专区 | 繁體中文 | 奖励公告栏 | 直通车账号登陆 | 关闭GOOGLE广告 | 临时留言    
 
广告
评论:实时显示DOS程序执行的小软件含代码 v1.0.1
63226526yuan 35671 2008/10/9 14:36:18
这个程序好象有点问题啊,我每执行一次cmd命令,从windows资源管理器中看到创建了新的线程,但是也不会释放,
而且 ping 127.0.0.1 -t 不能停止??
duckyyy 34652 2008/6/16 23:41:29
好像不能spawn结束,dos可能还没结束
cocu_chen 19516 2005/11/25 16:35:07
spawn程序用来实现重定向而已。
lovingtse 13622 2005/3/28 9:45:42
事实上楼主主要使用的就是spawn,不知道这是个什么文件,反正Win2K中找不到这个文件,又没有这个文件的源代码,还不如上面oiwin贴出的代码呢
wywllh 13537 2005/3/25 16:27:48
好像必须要目录下的 spawn.exe 文件才能正常运行,有没有更方便一点的呀!
wywllh 13526 2005/3/25 12:52:52
为什么把主程序中的代码移植到其它程序中,总是出现“创建进程错误!”的提示!
我都试了多次了,都不能成功呀?这是为什么????
oiwin 13409 2005/3/22 11:35:15
我也收藏了一个函数,可以把DOS程序的结果显示在MEMO中,与大家一起分享
//RunDosInMemo('ping 127.0.0.1',Memo1);
 
procedure RunDosInMemo(Que:String;EnMemo:TMemo);
  const
     CUANTOBUFFER = 2000;
  var
    Seguridades         : TSecurityAttributes;
    PaLeer,PaEscribir   : THandle;
    start          : TStartUpInfo;
    ProcessInfo         : TProcessInformation;
    Buffer          : Pchar;
    BytesRead          : DWord;
    CuandoSale          : DWord;
  begin
    with Seguridades do
    begin
      nlength          := SizeOf(TSecurityAttributes);
      binherithandle       := true;
      lpsecuritydescriptor := nil;
    end;
    {Creamos el pipe...}
    if Createpipe (PaLeer, PaEscribir, @Seguridades, 0) then
    begin
      Buffer  := AllocMem(CUANTOBUFFER + 1);
      FillChar(Start,Sizeof(Start),#0);
      start.cb          := SizeOf(start);
      start.hStdOutput  := PaEscribir;
      start.hStdInput   := PaLeer;
      start.dwFlags     := STARTF_USESTDHANDLES +
          STARTF_USESHOWWINDOW;
      start.wShowWindow := SW_HIDE;

      if CreateProcess(nil,
         PChar(Que),
         @Seguridades,
         @Seguridades,
         true,
         NORMAL_PRIORITY_CLASS,
         nil,
         nil,
         start,
         ProcessInfo)
      then
        begin
          {Espera a que termine la ejecucion}
          repeat
          CuandoSale := WaitForSingleObject( ProcessInfo.hProcess,100);
          Application.ProcessMessages;
          until (CuandoSale <> WAIT_TIMEOUT);
          {Leemos la Pipe}
          repeat
          BytesRead := 0;
          {Llenamos un troncho de la pipe, igual a nuestro buffer}
          ReadFile(PaLeer,Buffer[0],CUANTOBUFFER,BytesRead,nil);
          {La convertimos en una string terminada en cero}
          Buffer[BytesRead]:= #0;
          {Convertimos caracteres DOS a ANSI}
          OemToAnsi(Buffer,Buffer);
          EnMemo.Text := EnMemo.text + String(Buffer);
          until (BytesRead < CUANTOBUFFER);
        end;
      FreeMem(Buffer);
      CloseHandle(ProcessInfo.hProcess);
      CloseHandle(ProcessInfo.hThread);
      CloseHandle(PaLeer);
      CloseHandle(PaEscribir);
    end;
  end;
archai 13407 2005/3/22 11:29:58
我试了一下:windows的命令都可以
但运行非windows标准命令时有点问题,比如:
运行dos状态下的oracle导出程序时没有显示导出过程,
而在真正的dos窗口下运行,有正在导出什么表,多少行等详细记录
命令如下(以前我见有高手写过,可代码不见了,楼主能否帮我解决?):
exp80.exe system/manager@test buffer=10000000 file=d:\1.dmp
tim001 13401 2005/3/22 11:11:05
好一个滔滔江水!!值
acafeel2 13396 2005/3/22 11:00:53
强悍的程序,不得不说,对楼主的景仰如滔滔江水,一发不可收拾。。。
第一页 上一页 下一页 最后页 有 10 条纪录 共1页 1 - 10
 用户名:
 密 码:
自动登陆(30天有效)
 
  DELPHI盒子版权所有 技术支持:深圳市麟瑞科技有限公司 1999-2024 V4.01 粤ICP备10103342号-1 更新RSS列表