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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. About creating and hiding window in win32

About creating and hiding window in win32

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
6 Posts 4 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.
  • N Offline
    N Offline
    Nandu_77b
    wrote on last edited by
    #1

    I have created a win32 application, in which a window is created say mywindow1 and after that I am creating other window in the same application say mywindow2. Based upon some condition Mywindow2 is created, if the condition is not satisfied mywindow2 will not be created that is fine (no problem with this scenario). But when Mywindow2 is created it is not a child of mywindow1. While creating the mywindow2 I am using findwindow(null, “mywindow1”) method to get the handle and then using hidewindow(mywindow1hndl) mywindow1 is hided. Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it? Thanks, Nandu

    _ CPalliniC D 3 Replies Last reply
    0
    • N Nandu_77b

      I have created a win32 application, in which a window is created say mywindow1 and after that I am creating other window in the same application say mywindow2. Based upon some condition Mywindow2 is created, if the condition is not satisfied mywindow2 will not be created that is fine (no problem with this scenario). But when Mywindow2 is created it is not a child of mywindow1. While creating the mywindow2 I am using findwindow(null, “mywindow1”) method to get the handle and then using hidewindow(mywindow1hndl) mywindow1 is hided. Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it? Thanks, Nandu

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      How are you creating your window? Do you use the WS_CHILD value while creating it?

      You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

      N 1 Reply Last reply
      0
      • _ _AnsHUMAN_

        How are you creating your window? Do you use the WS_CHILD value while creating it?

        You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

        N Offline
        N Offline
        Nandu_77b
        wrote on last edited by
        #3

        As I mentioned mywindow2 is not a child of mywindow1. mywindow2 is total a separate window.

        1 Reply Last reply
        0
        • N Nandu_77b

          I have created a win32 application, in which a window is created say mywindow1 and after that I am creating other window in the same application say mywindow2. Based upon some condition Mywindow2 is created, if the condition is not satisfied mywindow2 will not be created that is fine (no problem with this scenario). But when Mywindow2 is created it is not a child of mywindow1. While creating the mywindow2 I am using findwindow(null, “mywindow1”) method to get the handle and then using hidewindow(mywindow1hndl) mywindow1 is hided. Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it? Thanks, Nandu

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          Since you know when first window is alive or not (after all you create, destroy or hide the window...) why don't you set a global flag and use it? :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          N 1 Reply Last reply
          0
          • CPalliniC CPallini

            Since you know when first window is alive or not (after all you create, destroy or hide the window...) why don't you set a global flag and use it? :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            N Offline
            N Offline
            Nandu_77b
            wrote on last edited by
            #5

            What will happen or what will be the problem if I hide and create window as mentioned above. Why we should go that way and problem it will cause and why is it a bad idea?

            1 Reply Last reply
            0
            • N Nandu_77b

              I have created a win32 application, in which a window is created say mywindow1 and after that I am creating other window in the same application say mywindow2. Based upon some condition Mywindow2 is created, if the condition is not satisfied mywindow2 will not be created that is fine (no problem with this scenario). But when Mywindow2 is created it is not a child of mywindow1. While creating the mywindow2 I am using findwindow(null, “mywindow1”) method to get the handle and then using hidewindow(mywindow1hndl) mywindow1 is hided. Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it? Thanks, Nandu

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Nandu_77b wrote:

              Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it?

              Using FindWindow() could work or it could possibly result in a failure or a deadlock. What FindWindow() does internally is call EnumWindows(), and for each top-level window handle found, it sends a WM_GETTEXT message to the window handle. Now if the thread that owns the handle is blocked (e.g., on a Semaphore, a Mutex, an Event, an I/O operation, or some other manner), the SendMessage() call will block until that thread is freed up. Worst case, this may never happen so FindWindow() will block forever.

              "One man's wage rise is another man's price increase." - Harold Wilson

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              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