ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

Desperate app request - restore window positions after wake from sleep scrambles

<< < (6/13) > >>

mouser:
Ok here is latest version, which is working -- tweaked/fixed a few more things in skrommel code (duplicate entries in ini files, a compare of monitorstatus that was not doing a string compare, etc.); very messy and lots of logging, but working.

Skrommel hopefully you have a good file compare tool? (winmerge is free but i love Beyond Compare; if you dont have it let's get you a copy!)

[OLD FILE REMOVED SEE SUBSEQUENT POST]

mouser:
It actually *DOES* seem to work perfectly (other than the ugliness of all the maximized windows jumping around)!!!

This is quite remarkable to me as I 've been suffering through this problem for many months now and had basically given up on it.

I hadn't thought to watch for monitor on/off events.. This part of your approach is wonderful because I can essentially detect only these rare events of monitor on off and the script ONLY needs to take action on those events.  No background processing or periodic saving of window positions is actually needed as far as i can tell (at least for my situation).  So it's essentially not impacting pc performance at all.

Now it's just a matter of tweaking it to see if I can get it to operate in a little less jarring visual display.


Thank you so much skrommel!!!!  :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-*

After I finish mangling and testing the code I will post a new version.


mouser:
ps I think the most likely solution to avoiding the unmaximizing-moving-remaximizing fix that is needed for the scrambled windows, is to try to DETECT when a window has been IMPROPERLY MOVED by the OS.. Im thinking now, based on watching how the code works, that this might be possible.  Perhaps by saving in the ini file the MAXIMIZED (not normal) window location and checking that against the current one to see if it has moved physical maximized locations even if it hasn't changed the restored-state location..  But there may be an easier way.

mouser:
And here is the new code that does just what I suggested -- saves both maximized and normal window positions for each monitor, and then for windows that have mysteriously stayed maximized but moved to a different monitor, those are first restored before they are remaximized.  Other windows are left alone, which makes for much visual ugliness on screen.  (it might be possible to improve this further by making window invisible before unaximizing and remaximizing but that as this is only running on monitor wakeup i think it's no big deal).

I am really excited to try this for real when i wake up tomorrow.

[ps. I have been testing it using nircmd to put monitors to sleep -- my earlier reports that this did not reproduce the problem were wrong; turns out i just needed to give the monitors at least 30 seconds or so to go into power saving mode before waking them up).

I will report tomorrow on real-world test of the tool.  :Thmbsup:

[OLD FILE REMOVED SEE SUBSEQUENT POST]

mouser:
ps2. Skrommel - I think my new code that checks for maximized window position and does a restore-maximize cycle is needed even if you don't have my OS problem, if you wanted to properly restore a window that was saved maximized on one monitor and is newly maximized on a different monitor.  But it may be possible to avoid the restore-maximize cycle by just directly setting the window position while it's maximized to bring it back to the old monitor?

Another nice feature would be if the app checked to make sure that the restored positions were actually "visible" -- otherwise the app could end up moving things off screen if the old monitors did not all get reconnected, etc.  Not a concern for me just a future idea..

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version