SDL/w32: add ability to hide console
feature is currently commented out - waiting till discussion has ended svn-id: r53767
This commit is contained in:
parent
fa7e8a8eb3
commit
c9c9eafbbb
2 changed files with 50 additions and 0 deletions
|
@ -116,6 +116,26 @@ static AspectRatio getDesiredAspectRatio() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
struct SdlConsoleHidingWin32 {
|
||||
DWORD myPid;
|
||||
DWORD myTid;
|
||||
HWND consoleHandle;
|
||||
};
|
||||
|
||||
// console hiding for win32
|
||||
static BOOL CALLBACK initBackendFindConsoleWin32Proc(HWND hWnd, LPARAM lParam) {
|
||||
DWORD pid, tid;
|
||||
SdlConsoleHidingWin32 *variables = (SdlConsoleHidingWin32 *)lParam;
|
||||
tid = GetWindowThreadProcessId(hWnd, &pid);
|
||||
if ((tid == variables->myTid) && (pid == variables->myPid)) {
|
||||
variables->consoleHandle = hWnd;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
void OSystem_SDL::initBackend() {
|
||||
assert(!_inited);
|
||||
|
||||
|
@ -135,6 +155,25 @@ void OSystem_SDL::initBackend() {
|
|||
if (joystick_num > -1)
|
||||
sdlFlags |= SDL_INIT_JOYSTICK;
|
||||
|
||||
#if 0
|
||||
// NEW CODE TO HIDE CONSOLE FOR WIN32
|
||||
#if defined(WIN32)
|
||||
// console hiding for win32
|
||||
SdlConsoleHidingWin32 consoleHidingWin32;
|
||||
consoleHidingWin32.consoleHandle = 0;
|
||||
consoleHidingWin32.myPid = GetCurrentProcessId();
|
||||
consoleHidingWin32.myTid = GetCurrentThreadId();
|
||||
EnumWindows (initBackendFindConsoleWin32Proc, (LPARAM)&consoleHidingWin32);
|
||||
|
||||
if (!ConfMan.getBool("show_console")) {
|
||||
if (consoleHidingWin32.consoleHandle) {
|
||||
// We won't find a window with our TID/PID in case we were started from command-line
|
||||
ShowWindow(consoleHidingWin32.consoleHandle, SW_HIDE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (SDL_Init(sdlFlags) == -1) {
|
||||
error("Could not initialize SDL: %s", SDL_GetError());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue