Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. I can disable Minimize, maximize box in windows using API but restore box.

I can disable Minimize, maximize box in windows using API but restore box.

Scheduled Pinned Locked Moved C#
json
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kernel1001
    wrote on last edited by
    #1

    I use API following to disable minimize, maximize box in windows. But i can't do that with restore button. I'm quite confused.

    SetWindowLong(hwnd, GWL_STYLE,0x16CC0000);

    0x16CC0000: remove maximize, minimize box. But i can't find the other code for restore box.

    T C 2 Replies Last reply
    0
    • K Kernel1001

      I use API following to disable minimize, maximize box in windows. But i can't do that with restore button. I'm quite confused.

      SetWindowLong(hwnd, GWL_STYLE,0x16CC0000);

      0x16CC0000: remove maximize, minimize box. But i can't find the other code for restore box.

      T Offline
      T Offline
      TheDudeJuan
      wrote on last edited by
      #2

      can't you just change the FormBorderStyle to SizeableToolWindow or FixedToolWindow? :)

      Here we rest... So why not make the best of it? :D

      K 1 Reply Last reply
      0
      • T TheDudeJuan

        can't you just change the FormBorderStyle to SizeableToolWindow or FixedToolWindow? :)

        Here we rest... So why not make the best of it? :D

        K Offline
        K Offline
        Kernel1001
        wrote on last edited by
        #3

        I load another application into winform and i want it not to resize. So i must use API to control. I think i can't use FormBorderStyle or FixedToolWindow. :)

        T 1 Reply Last reply
        0
        • K Kernel1001

          I load another application into winform and i want it not to resize. So i must use API to control. I think i can't use FormBorderStyle or FixedToolWindow. :)

          T Offline
          T Offline
          TheDudeJuan
          wrote on last edited by
          #4

          if you don't want to allow the form to be resized you can set the MaximumSize and MinimumSize properties of the form so it will keep the current size. if you already set the size of your form you can do this:

          yourForm.MaximumSize = yourForm.Size;
          yourForm.MinimumSize = yourForm.Size;

          then it can't be resized even if the restore button isn't disabled ;)

          Here we rest... So why not make the best of it? :D

          K 1 Reply Last reply
          0
          • K Kernel1001

            I use API following to disable minimize, maximize box in windows. But i can't do that with restore button. I'm quite confused.

            SetWindowLong(hwnd, GWL_STYLE,0x16CC0000);

            0x16CC0000: remove maximize, minimize box. But i can't find the other code for restore box.

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            If you're using C#, then why on earth would you do this ? That's just insane. You can disallow all these buttons in the properties dialog for the form, including the the restore box.

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            K 1 Reply Last reply
            0
            • T TheDudeJuan

              if you don't want to allow the form to be resized you can set the MaximumSize and MinimumSize properties of the form so it will keep the current size. if you already set the size of your form you can do this:

              yourForm.MaximumSize = yourForm.Size;
              yourForm.MinimumSize = yourForm.Size;

              then it can't be resized even if the restore button isn't disabled ;)

              Here we rest... So why not make the best of it? :D

              K Offline
              K Offline
              Kernel1001
              wrote on last edited by
              #6

              But i'm loading another application (word office, eg.) into that form. So, when i resize the "inside" application, it also resizes the outside form too despite you fixing size of the outside form. I suppose that we must use some API functions to solve but i don't know exactly.

              1 Reply Last reply
              0
              • C Christian Graus

                If you're using C#, then why on earth would you do this ? That's just insane. You can disallow all these buttons in the properties dialog for the form, including the the restore box.

                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                K Offline
                K Offline
                Kernel1001
                wrote on last edited by
                #7

                You can fix size of the outside form, but when i resize inside application (eg. Word Office window) then the outside form is also changed despite it being fixed.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups