| Author |
Restore Form to Prior State
|
|
|
| Im trying to rstore a form to its prior state.
If you minimize a form and then right click on it in the
taskbar then there is a menu item labeled "Restore".
That is what i want to emulate.
Note that simply using me.windowstate = vbnormal
will not work as I want. i want to restore the form as
it was before it got minimized. So it may be maximized
or just normal.
I just cant figure out how to do it.
tia
AGP
| |
| Michael Cole 2005-05-26, 3:55 am |
| AGP wrote:
> Im trying to rstore a form to its prior state.
> If you minimize a form and then right click on it in the
> taskbar then there is a menu item labeled "Restore".
> That is what i want to emulate.
>
> Note that simply using me.windowstate = vbnormal
> will not work as I want. i want to restore the form as
> it was before it got minimized. So it may be maximized
> or just normal.
>
> I just cant figure out how to do it.
Save the previous WindowState, and then set it back to that in the Restore
action.
--
Regards,
Michael Cole
| |
|
| OK forgot to mention that...but I have already tried that...
in what event shall I save the state...the Form_Resize happens
after the form has been changed so I cant save the prior state.
I need an event that happens before the form is changed.
AGP
"Michael Cole" <noone@hansen.com> wrote in message
news:u3iuUxZYFHA.3280@TK2MSFTNGP09.phx.gbl...
> AGP wrote:
>
> Save the previous WindowState, and then set it back to that in the Restore
> action.
>
> --
> Regards,
>
> Michael Cole
>
>
| |
| Tom Esh 2005-05-26, 3:55 am |
| On Thu, 26 May 2005 02:52:48 GMT, "AGP" <sindizzy.pak@softhome.net>
wrote:
>OK forgot to mention that...but I have already tried that...
>in what event shall I save the state...the Form_Resize happens
>after the form has been changed so I cant save the prior state.
>I need an event that happens before the form is changed.
Simplest way is to use ShowWindow with SW_RESTORE:
'declares...
Private Const SW_RESTORE = 9
Private Declare Function ShowWindow Lib "user32" _
(ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
'usage...
ShowWindow Me.hWnd, SW_RESTORE
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
| |
| Jeff Johnson [MVP: VB] 2005-05-26, 3:55 am |
|
"Tom Esh" <tjeshGibberish@suscom.net> wrote in message
news:69fa915p38gjt013nbed9ge1uhddc54qqt@
4ax.com...
> Simplest way is to use ShowWindow with SW_RESTORE:
ShowWindow()! Yeah, that's right. I was going to send him the long way with
a WM_SYSCOMMAND message....
| |
| Tom Esh 2005-05-26, 8:55 am |
| On Thu, 26 May 2005 00:21:06 -0400, "Jeff Johnson [MVP: VB]"
<i.get@enough.spam> wrote:
>ShowWindow()! Yeah, that's right. I was going to send him the long way with
>a WM_SYSCOMMAND message....
Yup, plus it has the side benefit of working even when the form's
ControlBox prop is False. (Some syscommands don't unless you hack
around it by removing the sysmenu at runtime with the Api.)
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
| |
|
| That is exactly what i was looking for.
It works. Thanks!!!!
AGP
"Tom Esh" <tjeshGibberish@suscom.net> wrote in message
news:69fa915p38gjt013nbed9ge1uhddc54qqt@
4ax.com...
> On Thu, 26 May 2005 02:52:48 GMT, "AGP" <sindizzy.pak@softhome.net>
> wrote:
>
>
> Simplest way is to use ShowWindow with SW_RESTORE:
>
> 'declares...
> Private Const SW_RESTORE = 9
> Private Declare Function ShowWindow Lib "user32" _
> (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
>
> 'usage...
> ShowWindow Me.hWnd, SW_RESTORE
>
>
> -Tom
> MVP - Visual Basic
> (please post replies to the newsgroup)
|
|
|
|