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. Windows begetting other windows.

Windows begetting other windows.

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelptutorialquestion
9 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.
  • N Offline
    N Offline
    NullStream
    wrote on last edited by
    #1

    I've been trying this for hours but I can't seem to get one main window to create and show another separate window at run time. ShowWindow() returns no error yet the new window still does not show. I'm very confused. Would someone be so kind as to write up a small snippet of code in which one open window creates an opens a second detached window so I can see what exactly it is I'm missing. I'm doing this in C only and using the base Win32 SDK and not MFC (which I won't even attempt until I understand how to effectively use the base Win32 SDK first). I can understand if someone doesn't want to write up a litte piece of code but if all else fails can some one direct me towards a document or website that can? All the documentation I have thus far explain how to use single windows and unique dialogs but not multiple windows. As well is there some macro I could use to print out debug statments (like what return values are without printing out a MessageBox() for everything? I apologize for my ignorance and stupidity and thank you all in advance. Sean Cody (NullStream) "Today is what ever I want it to mean." - Beth Orton

    C T 2 Replies Last reply
    0
    • N NullStream

      I've been trying this for hours but I can't seem to get one main window to create and show another separate window at run time. ShowWindow() returns no error yet the new window still does not show. I'm very confused. Would someone be so kind as to write up a small snippet of code in which one open window creates an opens a second detached window so I can see what exactly it is I'm missing. I'm doing this in C only and using the base Win32 SDK and not MFC (which I won't even attempt until I understand how to effectively use the base Win32 SDK first). I can understand if someone doesn't want to write up a litte piece of code but if all else fails can some one direct me towards a document or website that can? All the documentation I have thus far explain how to use single windows and unique dialogs but not multiple windows. As well is there some macro I could use to print out debug statments (like what return values are without printing out a MessageBox() for everything? I apologize for my ignorance and stupidity and thank you all in advance. Sean Cody (NullStream) "Today is what ever I want it to mean." - Beth Orton

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

      For the CreateWindow problem, it would help to see your code. For the trace, try OutputDebugString. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?! - Jon Hulatt, 22/3/2002

      N 1 Reply Last reply
      0
      • C Christian Graus

        For the CreateWindow problem, it would help to see your code. For the trace, try OutputDebugString. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?! - Jon Hulatt, 22/3/2002

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

        I can send code upon request as the code to generate and show the 2 windows is larger than it is appropriate to post to this forum. Sean Cody (NullStream) "Today is what ever I want it to mean." - Beth Orton

        1 Reply Last reply
        0
        • N NullStream

          I've been trying this for hours but I can't seem to get one main window to create and show another separate window at run time. ShowWindow() returns no error yet the new window still does not show. I'm very confused. Would someone be so kind as to write up a small snippet of code in which one open window creates an opens a second detached window so I can see what exactly it is I'm missing. I'm doing this in C only and using the base Win32 SDK and not MFC (which I won't even attempt until I understand how to effectively use the base Win32 SDK first). I can understand if someone doesn't want to write up a litte piece of code but if all else fails can some one direct me towards a document or website that can? All the documentation I have thus far explain how to use single windows and unique dialogs but not multiple windows. As well is there some macro I could use to print out debug statments (like what return values are without printing out a MessageBox() for everything? I apologize for my ignorance and stupidity and thank you all in advance. Sean Cody (NullStream) "Today is what ever I want it to mean." - Beth Orton

          T Offline
          T Offline
          Tim Deveaux
          wrote on last edited by
          #4

          You might have a look at using SetWindowPos to see if that can make a difference - though you might have tried that already. What OS are you using? I have noticed different behavior in this area re w9x and NT/w2k.

          N 1 Reply Last reply
          0
          • T Tim Deveaux

            You might have a look at using SetWindowPos to see if that can make a difference - though you might have tried that already. What OS are you using? I have noticed different behavior in this area re w9x and NT/w2k.

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

            Windows XP and Visual Studio 6 SP5. Ok. I think my problem is coming due to a misunderstanding of how things are supposed to work. For any Win32 program you create a main window. You have to programmatically add any controls you want to this window. I was/is trying to create the main window yet fill it's contents with a dialog I made in the resource editor. Is this even possible? Then I would create another window in the same fashion and it doesn't show.... ugh. :mad: one day i'll see it.... but i don't think it will be today. Sean Cody (NullStream) "Today is what ever I want it to mean." - Beth Orton

            T 1 Reply Last reply
            0
            • N NullStream

              Windows XP and Visual Studio 6 SP5. Ok. I think my problem is coming due to a misunderstanding of how things are supposed to work. For any Win32 program you create a main window. You have to programmatically add any controls you want to this window. I was/is trying to create the main window yet fill it's contents with a dialog I made in the resource editor. Is this even possible? Then I would create another window in the same fashion and it doesn't show.... ugh. :mad: one day i'll see it.... but i don't think it will be today. Sean Cody (NullStream) "Today is what ever I want it to mean." - Beth Orton

              T Offline
              T Offline
              Tim Deveaux
              wrote on last edited by
              #6

              Well... how bout using CreateDialog? ed. (er, for the main window I mean) Mind, I do think its possible to do what you are trying to do, just checking.

              N 1 Reply Last reply
              0
              • T Tim Deveaux

                Well... how bout using CreateDialog? ed. (er, for the main window I mean) Mind, I do think its possible to do what you are trying to do, just checking.

                N Offline
                N Offline
                NullStream
                wrote on last edited by
                #7

                I just saw that myself. Basically I have 2 windows. Window #1 is a configuration window which accepts parameters for how Window #2 will work. Window #2 is just going to be a clean window which will have a DirectDraw surface on which I can paint via the options in Window #1. Now when Window #1 launches Window #2 I want it to go away as Window #2 will become the main window. When Window #2 closes the application closes. Is that too confusing? X| Sean Cody (NullStream) "Today is what ever I want it to mean." - Beth Orton

                T 2 Replies Last reply
                0
                • N NullStream

                  I just saw that myself. Basically I have 2 windows. Window #1 is a configuration window which accepts parameters for how Window #2 will work. Window #2 is just going to be a clean window which will have a DirectDraw surface on which I can paint via the options in Window #1. Now when Window #1 launches Window #2 I want it to go away as Window #2 will become the main window. When Window #2 closes the application closes. Is that too confusing? X| Sean Cody (NullStream) "Today is what ever I want it to mean." - Beth Orton

                  T Offline
                  T Offline
                  Tim Deveaux
                  wrote on last edited by
                  #8

                  I'd make the DD window (#2) the main one - possibly with just the WS_POPUP style set. At launch, show the config dialog first - DoModal would be easiest - then all you need to do is make sure it obscures the main one completely. If you want to ShowWindow(SW_HIDE) hide the main one, might have to make it a modeless dialog. You might even be able to get away with a create dialog in WinMain, or a well posted message to the main wind before WinMain exits (caught before the DD wind gets a chance to paint itself), but I'd have to experiment with that.

                  1 Reply Last reply
                  0
                  • N NullStream

                    I just saw that myself. Basically I have 2 windows. Window #1 is a configuration window which accepts parameters for how Window #2 will work. Window #2 is just going to be a clean window which will have a DirectDraw surface on which I can paint via the options in Window #1. Now when Window #1 launches Window #2 I want it to go away as Window #2 will become the main window. When Window #2 closes the application closes. Is that too confusing? X| Sean Cody (NullStream) "Today is what ever I want it to mean." - Beth Orton

                    T Offline
                    T Offline
                    Tim Deveaux
                    wrote on last edited by
                    #9

                    Oops - as usual, just saw the flaws in that previous reply... DoModal is the MFC for DialogBox, and I was wrong to use the phrase 'before WinMain exits' - what I meant was before WinMain fires up the main message pump. DialogBox will execute its own message pump, so I think you can call it from WinMain - you will probably want to have a separate dialog proc for it though.

                    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