Hi,
I've reported this before (a long time ago), but it's still in version 10.0.10586.0.
The app saves window size and position (the size and position of the icon in the task bar) even when it's not normalized. This is wrong, and leads to the window seemingly not opening (i.e. it opens, but cannot be seen) when, for example, being autostarted. The only option then is to right-click the icon, select maximize and then drag the window to a normalized state (size will be reset).
The correct algorithm on window close (or resize, but close is less intensive) should be:
1. Am I maximized (or did state change to maximized)? If so, store that state and don't touch position or size.
2. Am I minimized (or did state change to minimized)? If so, store that state and don't touch position or size.
3. Am I normalized (or did state change to normalized)? If so, store state, position and size.
Algorithm on window open (assuming the window isn't visible until done):
1. Set state to normal.
2. Restore position and size.
3. Restore state (if not normal).
(you may want to suspend the resize event during this operation, but it should work either way)
Caveat: This is from memory, I may have overlooked some case, but I'm sure you will analyze it properly anyway... :)
/Peter
Hello,
David will have a look at this when coming back from vacation.
Thank you for your patience ;)
Maurice
Hi,
I will have to verify but I think that I need to save the restored size and position in the structure, That's why we need to restore the window before saving the value. Do you have the problem only for the main form?
David Hervieux
Hi,
Just the main form.
The problem only shows when the app is minimized to the notification area and I log out or shut down (I of course always keep Remote Desktop Manager running, a click away). After that, I can't restore the app, because it restores to the size and position of the notification area icon... :)
Workaround: Right click, maximize, drag a little.
Tracking (saving them on close) the "last known size and position when restored" and setting them when the state changes to restored, should do the trick, I think. Not COMPLETELY sure, I've been doing web stuff for years now, no GUI apps.
Or?
/Peter
EDIT: Major rewrite after reading, I managed to confuse even myself...
We use this API
private static extern bool SetWindowPlacement(IntPtr handle, [In] ref WindowPlacement placement);
http://www.pinvoke.net/default.aspx/user32.setwindowplacement
With this structure:
http://www.pinvoke.net/default.aspx/Structures/WINDOWPLACEMENT.html
David Hervieux
Which command are you passing in when going from notification area to normal, and where do you get the rcNormalPosition value from?
IMPORTANT: It works fine once the app has been opened in normal state (according to my workaround). It is ONLY when the application starts minimized - after having been shut down minimized (the latter is an assumption, it may be the same either way it's shut down) - this happens (I have it like that in autostart).
So I would guess that your code there assumes the window HAS been normal once, which, in this case, it hasn't. If, for example, you use the SW_RESTORE command, I think you'd fail (a GUESS is that rcNormalPosition is ignored by that command), whereas SW_SHOWNORMAL (passing in the correct size) should work. Again, just guesswork, but... :)
--
Peter Josefsson
Hi,
I'm unable to reproduce it. I really need to find a way to reproduce the problem. I can assign this to our QA but I know he is really busy this week.
Regards
David Hervieux
Hi,
I'm REALLY sorry but I hadn't realized that our updates had expired, so the problem may well be long gone. I'm on 10.something. I've asked to have updates renewed, will get back to you if it persists after updating.
Again, sorry for not checking I was on a current version. My bad.
/Peter
Don't be sorry. It's possible that we still have the bug. You could request trial to test it if you want.
David Hervieux
Ah well... I'm a developer too... incomplete bug reports are the worst... so I'll stay a LITTLE sorry, at least. And I'll remind the boss about the license. :)