3 /* See if we were launched from a console window. */
\r
4 bool check_console() {
\r
5 /* If we're running in a service context there will be no console window. */
\r
6 HWND console = GetConsoleWindow();
\r
7 if (! console) return false;
\r
10 if (! GetWindowThreadProcessId(console, &pid)) return false;
\r
13 If the process associated with the console window handle is the same as
\r
14 this process, we were not launched from an existing console. The user
\r
15 probably double-clicked our executable.
\r
17 if (GetCurrentProcessId() != pid) return true;
\r
19 /* We close our new console so that subsequent messages appear in a popup. */
\r
24 void alloc_console(nssm_service_t *service) {
\r
25 if (service->no_console) return;
\r