-1

I want to run C console application without window or at background with hidden. Please guide me to do it. Thank you.

  • Are you looking for some `CreateProcess(...)` samples? It's hard to imagine this is about any OS other than Windows(R). – polarysekt Jun 03 '15 at 03:24
  • possible duplicate of [Make a minGW console program run without the console](http://stackoverflow.com/questions/5553110/make-a-mingw-console-program-run-without-the-console) – Swanand Jun 03 '15 at 04:50

2 Answers2

0

On Windows use ShowWindow(FindWindowA("ConsoleWindowClass", NULL), false) to hide the console window. It will still be running in the background and is not visible on the taskbar.

However you will have to run a task manager like Taskmgr.exe to find it and shut it down.

#include <windows.h>  
#include <iostream>     
using namespace std;


int main () {   

    ShowWindow(FindWindowA("ConsoleWindowClass", NULL), false);

    while(true) {
                 // Do your hidden stuff in here
    }   
return 0;
}
Software_Designer
  • 8,490
  • 3
  • 24
  • 28
-1

Can use C in with "stdbool.h" like ShowWindow(FindWindowA("ConsoleWindowClass", NULL), false);

or

ShowWindow(FindWindowA("ConsoleWindowClass", NULL), 0);