Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
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



Report this thread to moderator Post Follow-up to this message
Old Post
AGP
05-26-05 08:55 AM


Re: Restore Form to Prior State
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



Report this thread to moderator Post Follow-up to this message
Old Post
Michael Cole
05-26-05 08:55 AM


Re: Restore Form to Prior State
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
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
AGP
05-26-05 08:55 AM


Re: Restore Form to Prior State
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)

Report this thread to moderator Post Follow-up to this message
Old Post
Tom Esh
05-26-05 08:55 AM


Re: Restore Form to Prior State
"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....



Report this thread to moderator Post Follow-up to this message
Old Post
Jeff Johnson [MVP: VB]
05-26-05 08:55 AM


Re: Restore Form to Prior State
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)

Report this thread to moderator Post Follow-up to this message
Old Post
Tom Esh
05-26-05 01:55 PM


Re: Restore Form to Prior State
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)



Report this thread to moderator Post Follow-up to this message
Old Post
AGP
05-27-05 08:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:29 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.