Hello, I am trying using C# to enable a funcionality which allow an application to read current status of the Monitor. To determine if the monitor has been turned off or on by the computer to be exact.
I have tried the above and in deed the event happens onpy when monitor is put into sleep or wokenn by by moving mouse/pressing a key on a keyboard. However the return value i get is always 2. I need also to thetermine the if the event was to suspend or to wake up the monitor. I have tried also different code snippets I have found on the internet but the one above gave best results so far. Not good enough though.
In theory the SC_MONITORPOWER (or the lParam to be percise) should return as follows:
Yet it returns always a value of 2.
So far I am developing this on WIN10, but the target OS would be win7. As far as i know the Power Managament differs from win8 and up.

I have tried the above and in deed the event happens onpy when monitor is put into sleep or wokenn by by moving mouse/pressing a key on a keyboard. However the return value i get is always 2. I need also to thetermine the if the event was to suspend or to wake up the monitor. I have tried also different code snippets I have found on the internet but the one above gave best results so far. Not good enough though.
In theory the SC_MONITORPOWER (or the lParam to be percise) should return as follows:

Yet it returns always a value of 2.
So far I am developing this on WIN10, but the target OS would be win7. As far as i know the Power Managament differs from win8 and up.