I am trying to capture comanndline application's output.I have used Iczelion's snippet for this purpose.However his code shows output only everything is done.Also it shows final output.I want to see the output realtime just like command promt.Because this commandline application(7zip commandline) can take time when doing his job and shows simple progress bar.

mov sat.nLength,sizeof SECURITY_ATTRIBUTES
mov sat.lpSecurityDescriptor,NULL
mov sat.bInheritHandle,TRUE
invoke CreatePipe,addr hRead,addr hWrite,addr sat,NULL
.if eax==NULL
; invoke MessageBox,hWnd,addr CreatePipeError,addr AppName,MB_ICONERROR+MB_OK
mov startupinfo.cb,sizeof STARTUPINFO
invoke GetStartupInfo,addr startupinfo
mov eax,hWrite
mov startupinfo.hStdOutput,eax
mov startupinfo.hStdError,eax
mov startupinfo.wShowWindow,SW_HIDE
; Create process
invoke CreateProcess,NULL,addr CommandLine,NULL,NULL,TRUE,NULL,NULL,NULL,addr startupinfo,addr pinfo
.if eax==NULL
;invoke MessageBox,hWnd,addr CreateProcessError,addr AppName,MB_ICONERROR+MB_OK
invoke CloseHandle,pinfo.hProcess
invoke CloseHandle,pinfo.hThread
invoke CloseHandle,hWrite

.while TRUE
invoke RtlZeroMemory,addr buffer,1024
invoke ReadFile,hRead,addr buffer,1023,addr bytesRead,NULL
.if eax==NULL
invoke SendMessage,hLog,EM_SETSEL,-1,0
invoke SendMessage,hLog,EM_REPLACESEL,FALSE,addr buffer

invoke CloseHandle,hRead
Posted on 2005-03-24 08:43:51 by LaptoniC
pack away
Posted on 2005-03-24 08:59:03 by fulminate
When the birds fly ?
What is the meaning of your cryptic reply.It is not my duty nor it is the place but please reply only if you have something valuable to add.Regards.
Posted on 2005-03-24 09:18:41 by LaptoniC