Click here to Skip to main content
16,004,927 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: OpenGL: How do I use idle func in Windows without using glutIdleFunc() Pin
El Corazon9-Oct-06 14:34
El Corazon9-Oct-06 14:34 
QuestionProblem using static solidbrush in GDI+ [modified] Pin
Stick^9-Oct-06 12:05
Stick^9-Oct-06 12:05 
AnswerRe: Problem using static solidbrush in GDI+ Pin
Mark Salsbery9-Oct-06 12:19
Mark Salsbery9-Oct-06 12:19 
GeneralRe: Problem using static solidbrush in GDI+ Pin
Stick^9-Oct-06 12:26
Stick^9-Oct-06 12:26 
GeneralRe: Problem using static solidbrush in GDI+ Pin
Mark Salsbery9-Oct-06 12:46
Mark Salsbery9-Oct-06 12:46 
GeneralRe: Problem using static solidbrush in GDI+ Pin
Stick^9-Oct-06 12:50
Stick^9-Oct-06 12:50 
GeneralRe: Problem using static solidbrush in GDI+ Pin
Mark Salsbery9-Oct-06 12:56
Mark Salsbery9-Oct-06 12:56 
QuestionProblem with output redirect Pin
eusto9-Oct-06 11:13
eusto9-Oct-06 11:13 
by my understanding of what i've found in msdn the folowing code should redirect the output of "ping www.google.com" to a file...and well...it doesn't. Where did i go wrong?

STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInfo;
ULONG rc;
HANDLE hFakeStdOut = CreateFile(
"C:\\myfile.txt",
GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL
);

if(hFakeStdOut==INVALID_HANDLE_VALUE)
{
printf("CreateFile failed with %d\n",GetLastError());
return;
}

memset(&StartupInfo, 0, sizeof(StartupInfo));
StartupInfo.cb = sizeof(STARTUPINFO);
StartupInfo.dwFlags = STARTF_USESTDHANDLES;
StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
StartupInfo.hStdOutput = hFakeStdOut;//GetStdHandle(STD_OUTPUT_HANDLE);
StartupInfo.hStdError = hFakeStdOut;//GetStdHandle(STD_ERROR_HANDLE);


char sCurDir[1023];
GetCurrentDirectory(1023,sCurDir);

if (!CreateProcess( NULL,
"ping www.google.com",
NULL,
NULL,
TRUE,
NULL,
NULL,
NULL,
&StartupInfo,
&ProcessInfo))
{
printf("Failed with %d\n",GetLastError());
}

WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
if(!GetExitCodeProcess(ProcessInfo.hProcess, &rc))
rc = 0;

CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
CloseHandle(hFakeStdOut);


I've been reading about this for about an hour now and i can't get it. Please help
AnswerRe: Problem with output redirect Pin
James R. Twine9-Oct-06 11:29
James R. Twine9-Oct-06 11:29 
GeneralRe: Problem with output redirect Pin
eusto9-Oct-06 12:06
eusto9-Oct-06 12:06 
AnswerRe: Problem with output redirect Pin
Mark Salsbery9-Oct-06 12:33
Mark Salsbery9-Oct-06 12:33 
GeneralRe: Problem with output redirect Pin
eusto9-Oct-06 22:30
eusto9-Oct-06 22:30 
AnswerRe: Problem with output redirect Pin
Naveen9-Oct-06 17:43
Naveen9-Oct-06 17:43 
QuestionWell like I said... Pin
Learn2LikeIt9-Oct-06 10:59
Learn2LikeIt9-Oct-06 10:59 
AnswerRe: Well like I said... Pin
led mike9-Oct-06 11:06
led mike9-Oct-06 11:06 
GeneralRe: Well like I said... Pin
Nibu babu thomas9-Oct-06 17:43
Nibu babu thomas9-Oct-06 17:43 
AnswerRe: Well like I said... Pin
Galatei10-Oct-06 2:50
Galatei10-Oct-06 2:50 
QuestionFunctions Pin
Learn2LikeIt9-Oct-06 10:54
Learn2LikeIt9-Oct-06 10:54 
AnswerRe: Functions Pin
Hamid_RT9-Oct-06 18:32
Hamid_RT9-Oct-06 18:32 
AnswerRe: Functions Pin
Tim Craig9-Oct-06 20:51
Tim Craig9-Oct-06 20:51 
Questiontimers in a console app Pin
eusto9-Oct-06 10:02
eusto9-Oct-06 10:02 
AnswerRe: timers in a console app Pin
led mike9-Oct-06 10:25
led mike9-Oct-06 10:25 
GeneralRe: timers in a console app Pin
eusto9-Oct-06 10:34
eusto9-Oct-06 10:34 
AnswerRe: timers in a console app Pin
Zac Howland9-Oct-06 10:35
Zac Howland9-Oct-06 10:35 
GeneralRe: timers in a console app Pin
led mike9-Oct-06 11:36
led mike9-Oct-06 11:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.