Merge branch 'master' of github.com:jclehner/nmrpflash

This commit is contained in:
Joseph C. Lehner 2017-01-13 11:39:12 +01:00
commit 495891fb6b

7
main.c
View file

@ -107,13 +107,14 @@ void require_admin()
void show_exit_prompt() void show_exit_prompt()
{ {
DWORD pid;
HWND win = GetConsoleWindow(); HWND win = GetConsoleWindow();
if (!win) { if (!win || !GetWindowThreadProcessId(win, &pid)) {
return; return;
} }
if (GetCurrentProcessId() == GetWindowThreadProcessId(win, NULL)) { if (GetCurrentProcessId() == pid) {
printf("\nPress any key to exit\n"); printf("Press any key to exit\n");
getch(); getch();
} }
} }