Prevent form minimize

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • M O J O

    #1

    Prevent form minimize

    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
  • rowe_newsgroups

    #2
    Re: Prevent form minimize

    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.ToInt3 2() = 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

    Comment

    • rowe_newsgroups

      #3
      Re: Prevent form minimize

      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.ToInt3 2()
      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.ToInt3 2() = 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

      Comment

      • M O J O

        #4
        Re: Prevent form minimize

        Hi Seth,

        That didn't work.

        Any idea?

        Thanks.

        M O J O

        "rowe_newsgroup s" 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.ToInt3 2() = 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
        >
        >

        Comment

        • Miro

          #5
          Re: Prevent form minimize

          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" <MOJO@discussio ns.microsoft.co mwrote in message
          news:26F492DB-8EA4-487E-B8BB-B35E7BD298E9@mi crosoft.com...
          Hi Seth,
          >
          That didn't work.
          >
          Any idea?
          >
          Thanks.
          >
          M O J O
          >
          "rowe_newsgroup s" 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.ToInt3 2() = 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
          >>
          >>

          Comment

          • rowe_newsgroups

            #6
            Re: Prevent form minimize

            Darn that pseudocode!

            Thanks,

            Seth Rowe


            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" <MOJO@discussio ns.microsoft.co mwrote in message
            news:26F492DB-8EA4-487E-B8BB-B35E7BD298E9@mi crosoft.com...
            Hi Seth,

            That didn't work.

            Any idea?

            Thanks.

            M O J O

            "rowe_newsgroup s" 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.ToInt3 2() = 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
            >
            >

            Comment

            • M O J O

              #7
              Re: Prevent form minimize

              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_newsgroup s" 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.ToInt3 2()
              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.ToInt3 2() = 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
              >
              >

              Comment

              • M O J O

                #8
                Re: Prevent form minimize

                Hi Miro,

                Please se my second answer to Seth.

                :o)

                M O J O

                "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" <MOJO@discussio ns.microsoft.co mwrote in message
                news:26F492DB-8EA4-487E-B8BB-B35E7BD298E9@mi crosoft.com...
                Hi Seth,

                That didn't work.

                Any idea?

                Thanks.

                M O J O

                "rowe_newsgroup s" 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.ToInt3 2() = 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
                >
                >
                >
                >
                >

                Comment

                • M O J O

                  #9
                  Re: Prevent form minimize

                  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


                  "rowe_newsgroup s" 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.ToInt3 2()
                  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.ToInt3 2() = 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
                  >
                  >

                  Comment

                  • M O J O

                    #10
                    Re: Prevent form minimize

                    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


                    Comment

                    • rowe_newsgroups

                      #11
                      Re: Prevent form minimize

                      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:
                      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_newsgroup s" 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.ToInt3 2()
                      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.ToInt3 2() = 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

                      Comment

                      • Herfried K. Wagner [MVP]

                        #12
                        Re: Prevent form minimize

                        "M O J O" <MOJO@discussio ns.microsoft.co mschrieb:
                        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.d e/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/>

                        Comment

                        Working...