문제

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.

도움이 되었습니까?

해결책

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top