X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=console.cpp;h=b8860215856f814f185c2cb0d546d393b6ae9d29;hb=62f28c55d444d846579159133dbe091809a2c08b;hp=9a977297f7ae5708191e04cd4302d0541a3f2c46;hpb=b6f7fe3b11fd130f46eb6b5009391cc3bb0cad49;p=nssm.git diff --git a/console.cpp b/console.cpp index 9a97729..b886021 100644 --- a/console.cpp +++ b/console.cpp @@ -1,23 +1,24 @@ #include "nssm.h" /* See if we were launched from a console window. */ -void check_console() { +bool check_console() { /* If we're running in a service context there will be no console window. */ HWND console = GetConsoleWindow(); - if (! console) return; + if (! console) return false; unsigned long pid; - if (! GetWindowThreadProcessId(console, &pid)) return; + if (! GetWindowThreadProcessId(console, &pid)) return false; /* If the process associated with the console window handle is the same as this process, we were not launched from an existing console. The user probably double-clicked our executable. */ - if (GetCurrentProcessId() != pid) return; + if (GetCurrentProcessId() != pid) return true; /* We close our new console so that subsequent messages appear in a popup. */ FreeConsole(); + return false; } /* Helpers for drawing the banner. */