Reputation: 23
I am writing a small c++ program that should react to the sc_screensaver
and sc_monitorpower
event.
this should run in background hence no gui is intended.
Since i have no experience with the windows api yet, i am struggling a lot with this.
A already googled a lot and found many approaches which either i dont understand or dont work.
Can anyone of you give me a hint?
I read its about catching the wm_syscommand
but that seems to be difficult because i dont have a window.
Upvotes: 1
Views: 657
Reputation: 20730
The only way to get messages is by a message loop and a window procedure.
If your program does not have a visible gui, you have to create a message-only window for that purpose, and your main
must have the code to create it and to listen windows messages (note: "windows" here, refers to the system, not the gui).
Upvotes: 2