This problem is part of a bigger one within my software that I need to get resolved promptly.
To see the problem at hand put together a quick sample Form1 in a new project and then add the following code to the Unload event.
MsgBox Me.Left & " - " & Me.Top
Then run the project and close the form while it's in the default restored position, you should see the Left and Top properties reported correctly.
Now run the project again and minimize the form before closing it through right-click taskbar menu. What I get when doing this is not the correct .Left and .Top properties but instead a fixed number for both, in my case 45,000 (twips) although I tested this on Win2k and it was a different fixed number. In both cases this point is way outside the screen boundaries, and causes havoc with my window positioning routines.
I tried using GetWindowRect API to get the RECT structure for the form while it was minimised, however, this again reported a fixed value of 45,000.
The .Left and .Top properties of the form cannot be changed while it is minimized or maximized, yet these values are changing when the form enters these two states?
What can I do to get the actual .Left and .Top properties reported when the form is about to close when minimised?
One solution I thought of would be to assign my own variables for Top and Left properties and to update these just before the form gets minimised, then use these for the window position save routine. This all seems a bit much though, and it seems like quite a major bug in VB, or possibly even Windows itself.