Home All Groups Group Topic Archive Search About

Prevent form minimize

Author
13 Oct 2006 3:57 PM
M O J O
Hi,

I'm creating my own Sidebar (like in Vista).

In my XP's quick menu, I have a button called "Show Desktop". When I click
it all forms are minimized.

Since I don't want my SideBar to be minimized, how do I prevent this?

Thanks!

M O J O

Author
13 Oct 2006 4:10 PM
rowe_newsgroups
Throw in the following:

Private Const WM_SYSCOMMAND As Int32 = &H112
Private Const SC_MINIMIZE As Int32 = &HF020

Protected Overrides Sub WndProc(ByRef m As Message)
    If m.Msg = WM_SYSCOMMAND Then
        if m.WParam.ToInt32() = SC_MINIMIZE then Exit Sub
    End If
    MyBase.WndProc(m)
End Sub

Thanks,

Seth Rowe


M O J O wrote:
Show quoteHide quote
> Hi,
>
> I'm creating my own Sidebar (like in Vista).
>
> In my XP's quick menu, I have a button called "Show Desktop". When I click
> it all forms are minimized.
>
> Since I don't want my SideBar to be minimized, how do I prevent this?
>
> Thanks!
>
> M O J O
Author
13 Oct 2006 4:13 PM
rowe_newsgroups
Oh by the way, here's the complete post from Herfried Wagner that that
code is based on:

Thanks,

Seth Rowe


> Is there a way I can get into a form's close/minimize/maximize events when
> those buttons (the 3 small squared button in the upper right corner of a
> form) are clicked?

\\\
Private Const WM_SYSCOMMAND As Int32 = &H112

Private Const SC_MAXIMIZE As Int32 = &HF030
Private Const SC_MINIMIZE As Int32 = &HF020
Private Const SC_RESTORE As Int32 = &HF120
Private Const SC_CLOSE As Int32 = &HF060

Protected Overrides Sub WndProc(ByRef m As Message)
    If m.Msg = WM_SYSCOMMAND Then
        Select Case m.WParam.ToInt32()
            Case SC_MAXIMIZE
                Debug.WriteLine("Form gets maximized.")
            Case SC_MINIMIZE
                Debug.WriteLine("Form gets minimized.")
            Case SC_RESTORE
                Debug.WriteLine("Form gets restored.")
            Case SC_CLOSE
                Debug.WriteLine("Form gets closed.")
        End Select
    End If
    MyBase.WndProc(m)
End Sub
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>



rowe_newsgroups wrote:
Show quoteHide quote
> Throw in the following:
>
> Private Const WM_SYSCOMMAND As Int32 = &H112
> Private Const SC_MINIMIZE As Int32 = &HF020
>
> Protected Overrides Sub WndProc(ByRef m As Message)
>     If m.Msg = WM_SYSCOMMAND Then
>         if m.WParam.ToInt32() = SC_MINIMIZE then Exit Sub
>     End If
>     MyBase.WndProc(m)
> End Sub
>
> Thanks,
>
> Seth Rowe
>
>
> M O J O wrote:
> > Hi,
> >
> > I'm creating my own Sidebar (like in Vista).
> >
> > In my XP's quick menu, I have a button called "Show Desktop". When I click
> > it all forms are minimized.
> >
> > Since I don't want my SideBar to be minimized, how do I prevent this?
> >
> > Thanks!
> >
> > M O J O
Author
13 Oct 2006 4:49 PM
M O J O
Hi Seth,

Thanks for helping me out here.

If I minimize all forms using the "Show Dekstop" button (in the quick
menu/quick start ... dunno what it's called in the english version of XP ..
it's right next to the start button in the lower left of the XP desktop
screen), the code doesn't work. It only works if I minimize the form itself.

Hope you get what I mean. :o)

Thanks!!!

M O J O

Show quoteHide quote
"rowe_newsgroups" wrote:

> Oh by the way, here's the complete post from Herfried Wagner that that
> code is based on:
>
> Thanks,
>
> Seth Rowe
>
>
> > Is there a way I can get into a form's close/minimize/maximize events when
> > those buttons (the 3 small squared button in the upper right corner of a
> > form) are clicked?
>
> \\\
> Private Const WM_SYSCOMMAND As Int32 = &H112
>
> Private Const SC_MAXIMIZE As Int32 = &HF030
> Private Const SC_MINIMIZE As Int32 = &HF020
> Private Const SC_RESTORE As Int32 = &HF120
> Private Const SC_CLOSE As Int32 = &HF060
>
> Protected Overrides Sub WndProc(ByRef m As Message)
>     If m.Msg = WM_SYSCOMMAND Then
>         Select Case m.WParam.ToInt32()
>             Case SC_MAXIMIZE
>                 Debug.WriteLine("Form gets maximized.")
>             Case SC_MINIMIZE
>                 Debug.WriteLine("Form gets minimized.")
>             Case SC_RESTORE
>                 Debug.WriteLine("Form gets restored.")
>             Case SC_CLOSE
>                 Debug.WriteLine("Form gets closed.")
>         End Select
>     End If
>     MyBase.WndProc(m)
> End Sub
> ///
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>
>
>
> rowe_newsgroups wrote:
> > Throw in the following:
> >
> > Private Const WM_SYSCOMMAND As Int32 = &H112
> > Private Const SC_MINIMIZE As Int32 = &HF020
> >
> > Protected Overrides Sub WndProc(ByRef m As Message)
> >     If m.Msg = WM_SYSCOMMAND Then
> >         if m.WParam.ToInt32() = SC_MINIMIZE then Exit Sub
> >     End If
> >     MyBase.WndProc(m)
> > End Sub
> >
> > Thanks,
> >
> > Seth Rowe
> >
> >
> > M O J O wrote:
> > > Hi,
> > >
> > > I'm creating my own Sidebar (like in Vista).
> > >
> > > In my XP's quick menu, I have a button called "Show Desktop". When I click
> > > it all forms are minimized.
> > >
> > > Since I don't want my SideBar to be minimized, how do I prevent this?
> > >
> > > Thanks!
> > >
> > > M O J O
>
>
Author
13 Oct 2006 4:58 PM
rowe_newsgroups
Yeah, I just tried out the full code too, and it doesn't even seem to
call the wndproc method. The shell command it is using is called
ToggleDesktop if that helps, but I'm not sure how to disable it. I'll
keep looking...

Thanks,

Seth Rowe


M O J O wrote:
Show quoteHide quote
> Hi Seth,
>
> Thanks for helping me out here.
>
> If I minimize all forms using the "Show Dekstop" button (in the quick
> menu/quick start ... dunno what it's called in the english version of XP ..
> it's right next to the start button in the lower left of the XP desktop
> screen), the code doesn't work. It only works if I minimize the form itself.
>
> Hope you get what I mean. :o)
>
> Thanks!!!
>
> M O J O
>
> "rowe_newsgroups" wrote:
>
> > Oh by the way, here's the complete post from Herfried Wagner that that
> > code is based on:
> >
> > Thanks,
> >
> > Seth Rowe
> >
> >
> > > Is there a way I can get into a form's close/minimize/maximize events when
> > > those buttons (the 3 small squared button in the upper right corner of a
> > > form) are clicked?
> >
> > \\\
> > Private Const WM_SYSCOMMAND As Int32 = &H112
> >
> > Private Const SC_MAXIMIZE As Int32 = &HF030
> > Private Const SC_MINIMIZE As Int32 = &HF020
> > Private Const SC_RESTORE As Int32 = &HF120
> > Private Const SC_CLOSE As Int32 = &HF060
> >
> > Protected Overrides Sub WndProc(ByRef m As Message)
> >     If m.Msg = WM_SYSCOMMAND Then
> >         Select Case m.WParam.ToInt32()
> >             Case SC_MAXIMIZE
> >                 Debug.WriteLine("Form gets maximized.")
> >             Case SC_MINIMIZE
> >                 Debug.WriteLine("Form gets minimized.")
> >             Case SC_RESTORE
> >                 Debug.WriteLine("Form gets restored.")
> >             Case SC_CLOSE
> >                 Debug.WriteLine("Form gets closed.")
> >         End Select
> >     End If
> >     MyBase.WndProc(m)
> > End Sub
> > ///
> >
> > --
> >  M S   Herfried K. Wagner
> > M V P  <URL:http://dotnet.mvps.org/>
> >  V B   <URL:http://classicvb.org/petition/>
> >
> >
> >
> > rowe_newsgroups wrote:
> > > Throw in the following:
> > >
> > > Private Const WM_SYSCOMMAND As Int32 = &H112
> > > Private Const SC_MINIMIZE As Int32 = &HF020
> > >
> > > Protected Overrides Sub WndProc(ByRef m As Message)
> > >     If m.Msg = WM_SYSCOMMAND Then
> > >         if m.WParam.ToInt32() = SC_MINIMIZE then Exit Sub
> > >     End If
> > >     MyBase.WndProc(m)
> > > End Sub
> > >
> > > Thanks,
> > >
> > > Seth Rowe
> > >
> > >
> > > M O J O wrote:
> > > > Hi,
> > > >
> > > > I'm creating my own Sidebar (like in Vista).
> > > >
> > > > In my XP's quick menu, I have a button called "Show Desktop". When I click
> > > > it all forms are minimized.
> > > >
> > > > Since I don't want my SideBar to be minimized, how do I prevent this?
> > > >
> > > > Thanks!
> > > >
> > > > M O J O
> >
> >
Author
13 Oct 2006 4:55 PM
M O J O
Hi Seth,

I googled around and found out, that clicking the "Show Desktop" button,
doesn't minimize all windows, it just puts the "Desktop" infront of all other
running apps.

So now I have to figure out how to trap, when desktop is brought to the
foreground.

Any idea???

:o)

Thanks!

M O J O


Show quoteHide quote
"rowe_newsgroups" wrote:

> Oh by the way, here's the complete post from Herfried Wagner that that
> code is based on:
>
> Thanks,
>
> Seth Rowe
>
>
> > Is there a way I can get into a form's close/minimize/maximize events when
> > those buttons (the 3 small squared button in the upper right corner of a
> > form) are clicked?
>
> \\\
> Private Const WM_SYSCOMMAND As Int32 = &H112
>
> Private Const SC_MAXIMIZE As Int32 = &HF030
> Private Const SC_MINIMIZE As Int32 = &HF020
> Private Const SC_RESTORE As Int32 = &HF120
> Private Const SC_CLOSE As Int32 = &HF060
>
> Protected Overrides Sub WndProc(ByRef m As Message)
>     If m.Msg = WM_SYSCOMMAND Then
>         Select Case m.WParam.ToInt32()
>             Case SC_MAXIMIZE
>                 Debug.WriteLine("Form gets maximized.")
>             Case SC_MINIMIZE
>                 Debug.WriteLine("Form gets minimized.")
>             Case SC_RESTORE
>                 Debug.WriteLine("Form gets restored.")
>             Case SC_CLOSE
>                 Debug.WriteLine("Form gets closed.")
>         End Select
>     End If
>     MyBase.WndProc(m)
> End Sub
> ///
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>
>
>
> rowe_newsgroups wrote:
> > Throw in the following:
> >
> > Private Const WM_SYSCOMMAND As Int32 = &H112
> > Private Const SC_MINIMIZE As Int32 = &HF020
> >
> > Protected Overrides Sub WndProc(ByRef m As Message)
> >     If m.Msg = WM_SYSCOMMAND Then
> >         if m.WParam.ToInt32() = SC_MINIMIZE then Exit Sub
> >     End If
> >     MyBase.WndProc(m)
> > End Sub
> >
> > Thanks,
> >
> > Seth Rowe
> >
> >
> > M O J O wrote:
> > > Hi,
> > >
> > > I'm creating my own Sidebar (like in Vista).
> > >
> > > In my XP's quick menu, I have a button called "Show Desktop". When I click
> > > it all forms are minimized.
> > >
> > > Since I don't want my SideBar to be minimized, how do I prevent this?
> > >
> > > Thanks!
> > >
> > > M O J O
>
>
Author
13 Oct 2006 4:56 PM
M O J O
Hi Seth,

I googled around and found out, that clicking the "Show Desktop" button,
doesn't minimize all windows, it just puts the "Desktop" infront of all other
running apps.

So now I have to figure out how to trap, when desktop is brought to the
foreground.

Any idea???

:o)

Thanks!

M O J O
Author
13 Oct 2006 4:24 PM
M O J O
Hi Seth,

That didn't work.

Any idea?

Thanks.

M O J O

Show quoteHide quote
"rowe_newsgroups" wrote:

> Throw in the following:
>
> Private Const WM_SYSCOMMAND As Int32 = &H112
> Private Const SC_MINIMIZE As Int32 = &HF020
>
> Protected Overrides Sub WndProc(ByRef m As Message)
>     If m.Msg = WM_SYSCOMMAND Then
>         if m.WParam.ToInt32() = SC_MINIMIZE then Exit Sub
>     End If
>     MyBase.WndProc(m)
> End Sub
>
> Thanks,
>
> Seth Rowe
>
>
> M O J O wrote:
> > Hi,
> >
> > I'm creating my own Sidebar (like in Vista).
> >
> > In my XP's quick menu, I have a button called "Show Desktop". When I click
> > it all forms are minimized.
> >
> > Since I don't want my SideBar to be minimized, how do I prevent this?
> >
> > Thanks!
> >
> > M O J O
>
>
Author
13 Oct 2006 4:30 PM
Miro
I used the original code and it worked from me.

-See the above post and try it with the case
and put the exist sub instead of the write line.

Miro

Show quoteHide quote
"M O J O" <M***@discussions.microsoft.com> wrote in message
news:26F492DB-8EA4-487E-B8BB-B35E7BD298E9@microsoft.com...
> Hi Seth,
>
> That didn't work.
>
> Any idea?
>
> Thanks.
>
> M O J O
>
> "rowe_newsgroups" wrote:
>
>> Throw in the following:
>>
>> Private Const WM_SYSCOMMAND As Int32 = &H112
>> Private Const SC_MINIMIZE As Int32 = &HF020
>>
>> Protected Overrides Sub WndProc(ByRef m As Message)
>>     If m.Msg = WM_SYSCOMMAND Then
>>         if m.WParam.ToInt32() = SC_MINIMIZE then Exit Sub
>>     End If
>>     MyBase.WndProc(m)
>> End Sub
>>
>> Thanks,
>>
>> Seth Rowe
>>
>>
>> M O J O wrote:
>> > Hi,
>> >
>> > I'm creating my own Sidebar (like in Vista).
>> >
>> > In my XP's quick menu, I have a button called "Show Desktop". When I
>> > click
>> > it all forms are minimized.
>> >
>> > Since I don't want my SideBar to be minimized, how do I prevent this?
>> >
>> > Thanks!
>> >
>> > M O J O
>>
>>
Author
13 Oct 2006 4:43 PM
rowe_newsgroups
Darn that pseudocode!

Thanks,

Seth Rowe


Miro wrote:
Show quoteHide quote
> I used the original code and it worked from me.
>
> -See the above post and try it with the case
> and put the exist sub instead of the write line.
>
> Miro
>
> "M O J O" <M***@discussions.microsoft.com> wrote in message
> news:26F492DB-8EA4-487E-B8BB-B35E7BD298E9@microsoft.com...
> > Hi Seth,
> >
> > That didn't work.
> >
> > Any idea?
> >
> > Thanks.
> >
> > M O J O
> >
> > "rowe_newsgroups" wrote:
> >
> >> Throw in the following:
> >>
> >> Private Const WM_SYSCOMMAND As Int32 = &H112
> >> Private Const SC_MINIMIZE As Int32 = &HF020
> >>
> >> Protected Overrides Sub WndProc(ByRef m As Message)
> >>     If m.Msg = WM_SYSCOMMAND Then
> >>         if m.WParam.ToInt32() = SC_MINIMIZE then Exit Sub
> >>     End If
> >>     MyBase.WndProc(m)
> >> End Sub
> >>
> >> Thanks,
> >>
> >> Seth Rowe
> >>
> >>
> >> M O J O wrote:
> >> > Hi,
> >> >
> >> > I'm creating my own Sidebar (like in Vista).
> >> >
> >> > In my XP's quick menu, I have a button called "Show Desktop". When I
> >> > click
> >> > it all forms are minimized.
> >> >
> >> > Since I don't want my SideBar to be minimized, how do I prevent this?
> >> >
> >> > Thanks!
> >> >
> >> > M O J O
> >>
> >>
Author
13 Oct 2006 4:50 PM
M O J O
Hi Miro,

Please se my second answer to Seth.

:o)

M O J O

Show quoteHide quote
"Miro" wrote:

> I used the original code and it worked from me.
>
> -See the above post and try it with the case
> and put the exist sub instead of the write line.
>
> Miro
>
> "M O J O" <M***@discussions.microsoft.com> wrote in message
> news:26F492DB-8EA4-487E-B8BB-B35E7BD298E9@microsoft.com...
> > Hi Seth,
> >
> > That didn't work.
> >
> > Any idea?
> >
> > Thanks.
> >
> > M O J O
> >
> > "rowe_newsgroups" wrote:
> >
> >> Throw in the following:
> >>
> >> Private Const WM_SYSCOMMAND As Int32 = &H112
> >> Private Const SC_MINIMIZE As Int32 = &HF020
> >>
> >> Protected Overrides Sub WndProc(ByRef m As Message)
> >>     If m.Msg = WM_SYSCOMMAND Then
> >>         if m.WParam.ToInt32() = SC_MINIMIZE then Exit Sub
> >>     End If
> >>     MyBase.WndProc(m)
> >> End Sub
> >>
> >> Thanks,
> >>
> >> Seth Rowe
> >>
> >>
> >> M O J O wrote:
> >> > Hi,
> >> >
> >> > I'm creating my own Sidebar (like in Vista).
> >> >
> >> > In my XP's quick menu, I have a button called "Show Desktop". When I
> >> > click
> >> > it all forms are minimized.
> >> >
> >> > Since I don't want my SideBar to be minimized, how do I prevent this?
> >> >
> >> > Thanks!
> >> >
> >> > M O J O
> >>
> >>
>
>
>
Author
13 Oct 2006 11:55 PM
Herfried K. Wagner [MVP]
"M O J O" <M***@discussions.microsoft.com> schrieb:
> I'm creating my own Sidebar (like in Vista).
>
> In my XP's quick menu, I have a button called "Show Desktop". When I click
> it all forms are minimized.
>
> Since I don't want my SideBar to be minimized, how do I prevent this?

Maybe registering the sidebar as an app bar will solve the problem:

<URL:http://groups.google.de/groups?q=appbar+dotnet>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>