I am really wigging out bro. I have been having weird problem after odd problem with this app I'm working on.
Okay, I was working on this code on my pc at home (running xp pro) with no worries. Now here at work (running 98se), I run it and am having my mind boggled. Check it:
The problem: GetStdHandle() with STD_INPUT_HANDLE or STD_OUTPUT_HANDLE returns INVALID_HANDLE_VALUE, but when I check the error code (with GetLastError()), no error code is denoted (zero is returned). Again, I didn't have this problem on my other box... Do you know what might be causing GetStdHandle() to fail (or actually, not fail, but return the aforementioned invalid value)?Code:hSaveStdin = GetStdHandle(STD_INPUT_HANDLE); if (hSaveStdin == INVALID_HANDLE_VALUE) { AfxMessageBox("hSaveStdin == INVALID_HANDLE_VALUE"); CString s; s.Format("Called GetStdHandle(STD_INPUT_HANDLE) - FAILURE# %d", GetLastError()); AfxMessageBox(s); }
In case you're wondering, I am using this to redirect the output of a console application (invoked with CreateProcess()) to file and to a control, but none of that happens until much later than these calls.