On Fri, Jun 18, 2010 at 03:00:52AM +0200, Enrico Forestieri wrote:
> I think that the solution could be hiding the console from inside
> LyX itself. Once there was code for doing that, but I don't remember
> anymore why it was nuked.
The attached patch hides the console window that would otherwise open.
It even closes the console window from which lyx is started, so maybe
a command line switch --hide-cmd could be added in case one wants a
visible console while running lyx.
--
Enrico
Index: src/support/os_win32.cpp
===================================================================
--- src/support/os_win32.cpp (revisione 34684)
+++ src/support/os_win32.cpp (copia locale)
@@ -87,6 +87,22 @@ BOOL terminate_handler(DWORD event)
return FALSE;
}
+
+void hide_console()
+{
+ HMODULE lib;
+ HWND WINAPI (*GetConsoleWindow) (void) = NULL;
+ HWND console = NULL;
+
+ if (lib = LoadLibrary("kernel32.dll"))
+ GetConsoleWindow = (HWND WINAPI (*) (void))
+ GetProcAddress(lib, "GetConsoleWindow");
+ if (GetConsoleWindow)
+ console = GetConsoleWindow();
+ if (console)
+ ShowWindow(console, SW_HIDE);
+}
+
} // namespace anon
void init(int argc, char * argv[])
@@ -148,6 +164,9 @@ void init(int argc, char * argv[])
*/
+ // Hide the console window
+ hide_console();
+
// Get the wide program arguments array
wchar_t ** envp = 0;
int newmode = 0;