Skip to content

Instantly share code, notes, and snippets.

@ariscop
Created July 19, 2014 08:09
Show Gist options
  • Save ariscop/6dc05549de0c7ec3e110 to your computer and use it in GitHub Desktop.
Save ariscop/6dc05549de0c7ec3e110 to your computer and use it in GitHub Desktop.
Function to check if a program was launched from cmd/powershell/so on
/* Detect if we're launched outside of cmd by checking for other processes on our console */
BOOL isTerminal(void) {
DWORD pid;
return GetConsoleProcessList(&pid, 1) != 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment