Prevent form minimize

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
///
 
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
 
Darn that pseudocode!

Thanks,

Seth Rowe

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
 
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
 
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
 
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
 
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
 
Back
Top