void InitConProc(HANDLE hFile, HANDLE heventParent, HANDLE heventChild) { DWORD dwID; // ignore if we don't have all the events. if (!hFile || !heventParent || !heventChild) return; hfileBuffer = hFile; heventParentSend = heventParent; heventChildSend = heventChild; // so we'll know when to go away. heventDone = CreateEvent(NULL, FALSE, FALSE, NULL); if (!heventDone) { Con_SafePrintf("Couldn't create heventDone\n"); return; } if (!CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) RequestProc, 0, 0, &dwID)) { CloseHandle(heventDone); Con_SafePrintf("Couldn't create QHOST thread\n"); return; } // save off the input/output handles. hStdout = GetStdHandle(STD_OUTPUT_HANDLE); hStdin = GetStdHandle(STD_INPUT_HANDLE); // force 80 character width, at least 25 character height SetConsoleCXCY(hStdout, 80, 25); }
BOOL SetScreenBufferLines (int iLines) { return SetConsoleCXCY (hStdout, 80, iLines); }
void InitConProc( int argc, char **argv ) { unsigned threadAddr; HANDLE hFile = NULL; HANDLE heventParent = NULL; HANDLE heventChild = NULL; int t; ccom_argc = argc; if( argv ) ccom_argv = argv; else ccom_argv = NULL; // give QHOST a chance to hook into the console if( ( t = CCheckParm( "-HFILE" ) ) > 0 ) { if( t < argc ) hFile = (HANDLE) (qintptr) atol( ccom_argv[t+1] ); } if( ( t = CCheckParm( "-HPARENT" ) ) > 0 ) { if( t < argc ) heventParent = (HANDLE) (qintptr) atol( ccom_argv[t+1] ); } if( ( t = CCheckParm( "-HCHILD" ) ) > 0 ) { if( t < argc ) heventChild = (HANDLE) (qintptr) atol( ccom_argv[t+1] ); } // ignore if we don't have all the events. if( !hFile || !heventParent || !heventChild ) { printf( "Qhost not present.\n" ); return; } printf( "Initializing for qhost.\n" ); hfileBuffer = hFile; heventParentSend = heventParent; heventChildSend = heventChild; // so we'll know when to go away. heventDone = CreateEvent( NULL, FALSE, FALSE, NULL ); if( !heventDone ) { printf( "Couldn't create heventDone\n" ); return; } if( !_beginthreadex( NULL, 0, RequestProc, NULL, 0, &threadAddr ) ) { CloseHandle( heventDone ); printf( "Couldn't create QHOST thread\n" ); return; } // save off the input/output handles. hStdout = GetStdHandle( STD_OUTPUT_HANDLE ); hStdin = GetStdHandle( STD_INPUT_HANDLE ); // force 80 character width, at least 25 character height SetConsoleCXCY( hStdout, 80, 25 ); }
/* ============== InitConProc ============== */ void InitConProc ( void ) { unsigned threadAddr; HANDLE hFile = (HANDLE)0; HANDLE heventParent = (HANDLE)0; HANDLE heventChild = (HANDLE)0; int WantHeight = 50; const char *p; // give external front ends a chance to hook into the console if ( CommandLine()->CheckParm ( "-HFILE", &p ) && p ) { hFile = (HANDLE)atoi ( p ); } if ( CommandLine()->CheckParm ( "-HPARENT", &p ) && p ) { heventParent = (HANDLE)atoi ( p ); } if ( CommandLine()->CheckParm ( "-HCHILD", &p ) && p ) { heventChild = (HANDLE)atoi ( p ); } // ignore if we don't have all the events. if ( !hFile || !heventParent || !heventChild ) { //sys->Printf ("\n\nNo external front end present.\n" ); return; } sys->Printf( "\n\nInitConProc: Setting up external control.\n" ); hfileBuffer = hFile; heventParentSend = heventParent; heventChildSend = heventChild; // So we'll know when to go away. heventDone = CreateEvent (NULL, FALSE, FALSE, NULL); if (!heventDone) { sys->Printf ("InitConProc: Couldn't create heventDone\n"); return; } if (!_beginthreadex (NULL, 0, RequestProc, NULL, 0, &threadAddr)) { CloseHandle (heventDone); sys->Printf ("InitConProc: Couldn't create third party thread\n"); return; } // save off the input/output handles. hStdout = GetStdHandle (STD_OUTPUT_HANDLE); hStdin = GetStdHandle (STD_INPUT_HANDLE); if ( CommandLine()->CheckParm( "-conheight", &p ) && p ) { WantHeight = atoi( p ); } // Force 80 character width, at least 25 character height SetConsoleCXCY( hStdout, 80, WantHeight ); }