sambul35 wrote:trying to test the assumption that monitor goes to sleep because the original exe was compiled for an older Win version
No, the executable is compiled a special windows api.
If windows supports this api, then the program is executed with no problems.
Actual APIs are "Win32"/"Win64" and ".NET":
Since XP 32 bit systems use "Win32" and ".NET" and 64 bit systems use "Win64" and ".NET".
So an application that is compiled against Win32" and ".NET" will work on all 32 bit windows since then.
The monitor goes to sleep because this program tells him to do so:
"SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);"
The problem is, that the code that should rewake the monitor doesn't work since win8 (Hearsay: Only works under certain circumstances):
"SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) -1);"
Hearsay (don't know if that is true):
Since windows 8 (or so) its default behaviour when callling this line of code without proper initialization of monitor and graphic card is to do nearly nothing:
This initialization is part of the monitor/graphics card drivers and therefore not public available and also not standardized.
The workaround (to move the mouse) depends on the fact, that the system wakes up the monitor in a "clean way".
I assumed that you wanted to turn the monitor "off and on again".
If that is wrong, and you really want to read the EDID (and store it somewhere - for example to a file) then i guess you should read this (4. and 5. - i don't know it this suffices, but it sounds good):
http://ofekshilon.com/2011/11/13/reading-monitor-physical-dimensions-or-getting-the-edid-the-right-way/Sidenote:
It makes no difference how you access the WinAPI, so
if you compile and link the c++ files to executables,
then they will exactly do the same as the c# code above.
penpen