How can I force display detection in Windows?
You can try:
- You can use Spy++ to search for the windows that are open and take a look at their properties and messages.
- Use process to start "rundll32.exe shell32.dll,Control_RunDLL desk.cpl" or experiment with calling it directly to see if you can get a window handle, check below link for ideas.
- Use the code "send button click to external app" and modify it to search for a window with caption "Screen Resolution" and send a BN_CLICK to the childwindow with the caption "Detect".
- Since the computer is already on you might want to fire it up automatically on logon, for that use the task scheduler.
This will get you half-way there:
Execute: control.exe desk.cpl,Settings,@Settings
That will bring up the Screen Resolution panel directly.
I might also suggest a scripting tool like http://en.wikipedia.org/wiki/Windows_Script_HostAnd write a utility that'll open the panel and click the button.
Barring that it's possible that the control panel directly calls into a windows .dll which you can load and invoke in code directly, but that would require some sleuthing to detect. (you can start by running the .cpl in a debugger and see what happens when you click the detect).
Why not just use Do It Again and write a macro that resets the resolution for you by recording your mouse and keyboard actions?