C++ How do I hide a console window on startup?

后端 未结 9 722
悲哀的现实
悲哀的现实 2021-02-01 05:43

I want to know how to hide a console window when it starts.

It\'s for a keylogger program, but it\'s not my intention to hack someone. It\'s for a littl

9条回答
  •  轮回少年
    2021-02-01 05:49

    #include 
    #include 
    
    void Stealth()
    {
     HWND Stealth;
     AllocConsole();
     Stealth = FindWindowA("ConsoleWindowClass", NULL);
     ShowWindow(Stealth,0);
    }
    
    int main()
    {
      cout<<"this sentence is visible\n";
      Stealth(); //to hide console window
      cout<<"this sentence is not visible\n";
      system("PAUSE"); //here you can call any process silently like system("start chrome.exe") , so google chrome will open and will surprise user..
      return EXIT_SUCCESS;
    }
    

提交回复
热议问题