Make a C++ Program Run without a Window Using gcc/g++? -


this question has answer here:

i have program simple; plays single audio file defined path on loop forever until program terminated. code here:

#include <windows.h> #include <mmsystem.h> #include <iostream>  using namespace std;  int main(void) {     playsound("c:\\users\\ben\\desktop\\silence.wav", null, snd_loop | snd_async | snd_filename);     cin.get();     return 0; } 

the program runs fine, expect, generates blank console window, program would. since want have program running in background , not visible, possible write doesn't have window @ all? realize if did way out end process manager, that's fine. also, want in code only/from g++ compiler; tried reading on doing visual studio, never work, , seems unnecessary of scale. advice.

int main() {   freeconsole();   playsound(...);   ... } 

this kind of program can killed task manager. might want consider setting sort of ipc can instruct existing instance turn off sound , quit.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -