Author Topic: [Tutorial] Make applications run as a service C++  (Read 1400 times)

Offline JokeBOx

  • Advanced Member
  • *
  • Topic Author
  • Posts: 206
  • Karma: +8/-27
  • HELLO!!!!!!!!!!!!!!!
  • Awards Winner of 1 Photoshop Challenge Contest [COMMON]
    • View Profile
    • Awards
In C++ it is possible to hide the window and make the program run as a background service, luckily this is extremely easy to do.

First we add this as our first line of the program.

Code: [Select]
#define _WIN32_WINNT 0x0500
Then in our main() function, we add.

Code: [Select]
HWND hWnd = GetConsoleWindow();
ShowWindow(hWnd, SW_HIDE); 

This will result in our program becoming hidden

Here we have an example application that will run in the background for 10 seconds doing nothing.



Enjoy.