mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
check that GetConsoleTitle succeeded
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9887 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
48f1b22d5d
commit
81cc7aafd5
@ -1,3 +1,8 @@
|
||||
2005-04-29 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* os_win32.C (init): Merge changes from Asger's win32_kludge.diff
|
||||
file, primarily checking that GetConsoleTitle succeeded.
|
||||
|
||||
2005-04-25 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* abort.C:
|
||||
|
@ -53,7 +53,7 @@ void os::init(int /* argc */, char * argv[])
|
||||
*
|
||||
* #if defined (_WIN32)
|
||||
* # define WIN32_LEAN_AND_MEAN
|
||||
* # include <stdlib.h> // for __argc,__argv
|
||||
* # include <stdlib.h> // for __argc, __argv
|
||||
* # include <windows.h> // for WinMain
|
||||
* #endif
|
||||
*
|
||||
@ -63,7 +63,7 @@ void os::init(int /* argc */, char * argv[])
|
||||
* #if defined (_WIN32)
|
||||
* int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
* {
|
||||
* return mymain(__argc, __argv);
|
||||
* return mymain(__argc, __argv);
|
||||
* }
|
||||
* #endif
|
||||
*
|
||||
@ -89,12 +89,15 @@ void os::init(int /* argc */, char * argv[])
|
||||
// Close the console when run (probably)
|
||||
// not run from command prompt
|
||||
char WindowTitle[1024];
|
||||
HWND hwndFound;
|
||||
GetConsoleTitle(WindowTitle,1024);
|
||||
if (GetConsoleTitle(WindowTitle, sizeof(WindowTitle)) == 0) {
|
||||
// Could not get the title, so we just leave things as they are
|
||||
return;
|
||||
}
|
||||
|
||||
if ((strcmp(WindowTitle, argv[0]) == 0) ||
|
||||
(strcmp(WindowTitle,"LyX") == 0)) {
|
||||
(strcmp(WindowTitle, "LyX") == 0)) {
|
||||
// format a "unique" newWindowTitle
|
||||
wsprintf(WindowTitle,"%d/%d",
|
||||
wsprintf(WindowTitle, "%d/%d",
|
||||
GetTickCount(),
|
||||
GetCurrentProcessId());
|
||||
// change current window title
|
||||
@ -102,9 +105,9 @@ void os::init(int /* argc */, char * argv[])
|
||||
// ensure window title has been updated
|
||||
Sleep(40);
|
||||
// look for newWindowTitle
|
||||
hwndFound=FindWindow(NULL, WindowTitle);
|
||||
HWND const hwndFound = FindWindow(NULL, WindowTitle);
|
||||
// If found, hide it
|
||||
if ( hwndFound != NULL)
|
||||
if (hwndFound != NULL)
|
||||
ShowWindow( hwndFound, SW_HIDE);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user