Hi!
In the Hwgui a programers add this new function, but no compatible with
Harbour.
Can anybody add this function into xhb.lib ?
TIA,
Itamar M. Lins Jr.
FUNCTION WAITRUN( cRun )
Local hIn, hOut, nRet, hProc
// "Launching process", cProc
hProc := HB_OpenProcess( cRun , @hIn, @hOut, @hOut )
// "Reading output"
// "Waiting for process termination"
nRet := HB_ProcessValue( hProc )
FClose( hProc )
FClose( hIn )
FClose( hOut )
Return nRet
// This example implements a parent process launching a child process
// (it is shown in the next example).
PROCEDURE Main()
LOCAL cData := "Hello World"
LOCAL cEXE := "ChildProc.exe"
LOCAL nBytes, nChild, nError, nStdIN, nStdOUT, nStdERR
CLS
? "Opening child process:", cEXE
nChild := HB_OpenProcess( cEXE, @nStdIN, @nStdOUT, @nStdERR )
IF nChild < 0
? "Error:", FError()
QUIT
ENDIF
? "Sending data :", FWrite( nStdIN, cData )
? "Receiving data : "
cData := Space( 1000 )
nBytes := Fread( nStdOUT, @cData, Len(cData) )
?? Left( cData, nBytes )
? "Reading errors : "
cData := Space( 1000 )
nBytes := Fread( nStdERR, @cData, Len(cData) )
?? Left( cData, nBytes )
? "Waiting for end :", HB_ProcessValue( nChild )
FClose( nChild )
FClose( nStdIN )
FClose( nStdOUT )
FClose( nStdERR )
RETURN
_______________________________________________
Harbour-users mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour-users