grabbler
May 20th, 2005, 03:58 PM
When people create a consol windows project in vc++, it output onely one cmd prompt ? What if I'd like to output 2 or 3 at the same time ? Is that possible ? Thank you
|
Click to See Complete Forum and Search --> : Output one one command prompt grabbler May 20th, 2005, 03:58 PM When people create a consol windows project in vc++, it output onely one cmd prompt ? What if I'd like to output 2 or 3 at the same time ? Is that possible ? Thank you grabbler May 20th, 2005, 04:37 PM I never seem to get any help here, somebody gives me an explanation ?anyone ?? ahoodin May 20th, 2005, 04:46 PM Of course it is possible. Just use multiple handles. ahoodin void CConsoletestDlg::OnButton1() { char cbuffer[36]; DWORD dwout=1; AllocConsole(); HANDLE handle = GetStdHandle( STD_OUTPUT_HANDLE ); HANDLE handle2 = GetStdHandle(STD_INPUT_HANDLE); if (WriteConsole( handle, "Friend? Y/N\n", strlen("Friend? Y/N\n"), NULL, NULL) ) { AfxMessageBox("Write Error"); } { if ( !ReadConsole( handle2, &cbuffer[0], 2, &dwout, NULL ) ) { AfxMessageBox("Read Error");//use getlasterror } else { if (WriteConsole( handle, (void*)cbuffer[0], 1, NULL, NULL) ) { AfxMessageBox("Write Error"); } } } while (!(cbuffer[0] == 'y' || cbuffer[0] == 'Y'|| cbuffer[0] == 27)); FreeConsole(); } grabbler May 20th, 2005, 05:04 PM Thanks a lot, but is it possible to use ShellExecute to wake up another cmd ? I have never tried it before... codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |