R
hi,
mit unten stehenden code möchte ich diverse kommandozeilenprogramme starten un deren ausgabe einlesen und an ein textfeld oder messagebox übergeben.
das klappt soweit auch ganz gut, solange die ausgabe weniger als 2606 zeichen enthält. dann stoppt nämlich die anwendung und in dem textfeld stehen nur die werte bis [2606] + diese zeichen ¼*Æ
#define BUFFSIZE 4096
char cPipeResult[BUFFSIZE];
memset(cPipeResult,0,BUFFSIZE);
DWORD dwBytes =0;
PROCESS_INFORMATION PROCCINFO;
LPSECURITY_ATTRIBUTES lpPipeAttributes = NULL;
HANDLE hReadPipe;
HANDLE hWritePipe;
SECURITY_ATTRIBUTES SecAttribs;
SecAttribs.lpSecurityDescriptor = NULL;
SecAttribs.bInheritHandle = TRUE;
SecAttribs.nLength = sizeof(SecAttribs);
if( ! CreatePipe( &hReadPipe, &hWritePipe, &SecAttribs, 0))
{
AfxMessageBox("Konnte Pipe nicht erstellen");
}
else // Ok Prozess vorbereiten
{
STARTUPINFO INFO;
INFO.cb=sizeof(STARTUPINFO);
INFO.lpReserved=NULL;
INFO.lpDesktop= NULL;
INFO.lpTitle=NULL;
INFO.dwX=0;
INFO.dwY=0;
INFO.dwXSize=100;
INFO.dwYSize=100;
INFO.dwXCountChars=0;
INFO.dwYCountChars=0;
INFO.dwFillAttribute=NULL;
INFO.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW|STARTF_USEPOSITION;
INFO.wShowWindow= SW_SHOWNORMAL;
INFO.cbReserved2=0;
INFO.lpReserved2=NULL;
INFO.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
INFO.hStdOutput= hWritePipe;
INFO.hStdError= GetStdHandle(STD_ERROR_HANDLE);
CreateProcess( NULL,(LPTSTR)(LPCTSTR)CstringVariable, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE|
NORMAL_PRIORITY_CLASS, NULL,"C:\\", &INFO, &PROCCINFO);
WaitForSingleObject(PROCCINFO.hProcess, 5000);
ReadFile(hReadPipe, cPipeResult, sizeof(cPipeResult), &dwBytes,NULL);
//AfxMessageBox(cPipeResult,MB_OKCANCEL);
m_sDisplayText1 = cPipeResult;
UpdateData(FALSE);
}
}
Weiss jemand woran es liegen könnte?