Listing 4: Example of how to use PipedProcess
BOOL RunYourProgExeAndMakeSelect(CString CommandLine,
CString Command)
{
CString Response, tmpString;
CPipedProcess* RunProc = new CPipedProcess();
if(!RunProc -> CreateProc(CommandLine) {
delete RunProc;
return FALSE;
}
Command += "\r\n";
if(0 == (RunProc -> ProcessCommand(Command, Response))){
YourView -> MessageBox("Unable to process a command",
"Command processing error",
MB_ICONEXCLAMATION | MB_OK);
return FALSE;
}
//we need to read from pipe until "*****" appears
while( -1 == Response.Find("*****")) {
tmpString.Empty();
RunProc -> ReadFromPipe(tmpString);
Response += tmpString;
}
RunProc -> CloseChildProcess();
delete RunProc;
}
//End of File