From: Leon W. <moo...@us...> - 2005-03-24 09:00:19
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12155 Modified Files: AnyEdit.cpp AnyEdit.h Log Message: On W98 & W95 we need to attach a console to AnyEdit to be able to run Console Applications as Tools and capture the output. Index: AnyEdit.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEdit.cpp,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** AnyEdit.cpp 9 Feb 2005 21:16:12 -0000 1.107 --- AnyEdit.cpp 24 Mar 2005 09:00:10 -0000 1.108 *************** *** 139,142 **** --- 139,143 ---- m_pWorkspaceTags = new AETagMap; m_bDontAddToFileList = FALSE; + m_wConsole = NULL; } *************** *** 273,276 **** --- 274,310 ---- CSplashWnd::ShowSplashScreen(); + // We need to know wich version of Windows we are on. + // If we are on W95 or W98, we need a console associated + // with the application or the tools won't work. + OSVERSIONINFO osvi; + ZeroMemory( &osvi, sizeof( OSVERSIONINFO ) ); + osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); + if( GetVersionEx( &osvi ) ) + { + if( osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) + { + if( AllocConsole() ) + { + HWND (WINAPI* pGetConsoleWindow)() = (HWND (WINAPI*)())GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetConsoleWindow"); + if( NULL != pGetConsoleWindow ) + { + // If we have a function pointer, we use is it to get the + // Console Window. + m_wConsole = pGetConsoleWindow(); + } + else + { + // Ok, nu GetConsoleWindow pointer. First give the Console Window an + // unique name and find our named window. + SetConsoleTitle( "AnyEditConsole" ); + Sleep( 1 ); + m_wConsole = FindWindow( NULL, "AnyEditConsole" ); + } + // Now hide the Console Window if we found it. + if( m_wConsole ) ShowWindow( m_wConsole, SW_HIDE ); + } + } + } + // Standard initialization // If you are not using these features and wish to reduce the size *************** *** 537,540 **** --- 571,577 ---- } + // Free the allocated Console Window + if( m_wConsole ) FreeConsole(); + return CDumpHandleApp::ExitInstance(); } Index: AnyEdit.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEdit.h,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** AnyEdit.h 9 Feb 2005 21:16:15 -0000 1.69 --- AnyEdit.h 24 Mar 2005 09:00:10 -0000 1.70 *************** *** 153,156 **** --- 153,159 ---- BOOL m_bDontAddToFileList; + // A handle to the associated console window (Only valid on W95 or W98) + HWND m_wConsole; + protected: /// Manager class for all Find/Replace operations. *************** *** 221,224 **** --- 224,230 ---- BOOL OnFileSaveall(BOOL bClose); + /// Get the Associated Console Window + HWND GetConsoleWindow() { return m_wConsole; } + // Overrides // ClassWizard generated virtual function overrides |