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. WS_POPUP style windows

WS_POPUP style windows

Scheduled Pinned Locked Moved C / C++ / MFC
questionoraclesecurityjsonhelp
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.
  • H Offline
    H Offline
    HakunaMatada
    wrote on last edited by
    #1

    Hi, I have got a very basic question. Do WS_POPUP style windows get created in a separate thread than the thread which created them or do they run in the same thread and somehow also manage a message loop? Thanks,

    --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

    N J 2 Replies Last reply
    0
    • H HakunaMatada

      Hi, I have got a very basic question. Do WS_POPUP style windows get created in a separate thread than the thread which created them or do they run in the same thread and somehow also manage a message loop? Thanks,

      --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      HakunaMatada wrote:

      Do WS_POPUP style windows get created in a separate thread

      no. When you call createwindow() from a thread, what ever be its style, it is created in same thread.

      nave

      H 1 Reply Last reply
      0
      • N Naveen

        HakunaMatada wrote:

        Do WS_POPUP style windows get created in a separate thread

        no. When you call createwindow() from a thread, what ever be its style, it is created in same thread.

        nave

        H Offline
        H Offline
        HakunaMatada
        wrote on last edited by
        #3

        Thanks for taking the time out to reply but I do have some more queries.

        Naveen R wrote:

        no. When you call createwindow() from a thread, what ever be its style, it is created in same thread.

        If so, then what about the message loop. If I have a MainFrame window which in turn is creating 5 Popup windows, I believe that every window will have its own message loop. How does it maintain 6 message loops within the same thread? Thanks.

        --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

        N 1 Reply Last reply
        0
        • H HakunaMatada

          Thanks for taking the time out to reply but I do have some more queries.

          Naveen R wrote:

          no. When you call createwindow() from a thread, what ever be its style, it is created in same thread.

          If so, then what about the message loop. If I have a MainFrame window which in turn is creating 5 Popup windows, I believe that every window will have its own message loop. How does it maintain 6 message loops within the same thread? Thanks.

          --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          HakunaMatada wrote:

          I believe that every window will have its own message loop

          No. Only one meesage loop will be there. When a window is created, there will no message loop. we have to explicitly write the message after creating the function( MFC is internally doing this). In the MainFrame case you said the sequence will be... 1. Create MainFrame 2. Create 5 popup window 3. Start the message loop while( GetMessage())// this loop is normally called as message loop { TranslateMessage(); DispatchMessage(); } you can find this message loop in the CWinThread::PumpMessage() function.

          nave

          H 1 Reply Last reply
          0
          • N Naveen

            HakunaMatada wrote:

            I believe that every window will have its own message loop

            No. Only one meesage loop will be there. When a window is created, there will no message loop. we have to explicitly write the message after creating the function( MFC is internally doing this). In the MainFrame case you said the sequence will be... 1. Create MainFrame 2. Create 5 popup window 3. Start the message loop while( GetMessage())// this loop is normally called as message loop { TranslateMessage(); DispatchMessage(); } you can find this message loop in the CWinThread::PumpMessage() function.

            nave

            H Offline
            H Offline
            HakunaMatada
            wrote on last edited by
            #5

            So, what you are saying is that there is just one message loop which gets created and the framework makes it seem like all have separate message loops? Lets say for example... 1) Create MainFrame. 2) Run Message Loop. 3) Create 5 Popup windows on an event, say button click. Lets say the classes for the Mainframe and Popup windows are CMainFrame, CPopup1, CPopup2.... etc. All classes have their own message loops(BEGIN_MSG_MAP and END_MSG_MAP). Does the framework being used make us think that separate message loops are being used when in reality only message loop is being used or is the case otherwise? Thanks again for the answers.

            --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

            N 1 Reply Last reply
            0
            • H HakunaMatada

              So, what you are saying is that there is just one message loop which gets created and the framework makes it seem like all have separate message loops? Lets say for example... 1) Create MainFrame. 2) Run Message Loop. 3) Create 5 Popup windows on an event, say button click. Lets say the classes for the Mainframe and Popup windows are CMainFrame, CPopup1, CPopup2.... etc. All classes have their own message loops(BEGIN_MSG_MAP and END_MSG_MAP). Does the framework being used make us think that separate message loops are being used when in reality only message loop is being used or is the case otherwise? Thanks again for the answers.

              --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

              N Offline
              N Offline
              Naveen
              wrote on last edited by
              #6

              HakunaMatada wrote:

              All classes have their own message loops(BEGIN_MSG_MAP and END_MSG_MAP)

              BEGIN_MSG_MAP and END_MSG_MAP are not message loop, they are message maps. The function added between that macro will be called by the MFC framework when a message of corresponing type arrives in that window. The better method to explorer this type of thing is to step in to the code of MFC while debugging.

              nave

              H 1 Reply Last reply
              0
              • H HakunaMatada

                Hi, I have got a very basic question. Do WS_POPUP style windows get created in a separate thread than the thread which created them or do they run in the same thread and somehow also manage a message loop? Thanks,

                --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

                J Offline
                J Offline
                jhwurmbach
                wrote on last edited by
                #7

                HakunaMatada wrote:

                o WS_POPUP style windows get created in a separate thread than the thread which created them or do they run in the same thread

                Windows styles (like WS_POPUP) and threads are orthogonal concepts. WS_POPUP is about adorning your window (and maybe raising expectations in the user of your window). What you want to learn about is worker threads and UI threads! Maybe this[^] helps?


                Failure is not an option - it's built right in.

                H 1 Reply Last reply
                0
                • N Naveen

                  HakunaMatada wrote:

                  All classes have their own message loops(BEGIN_MSG_MAP and END_MSG_MAP)

                  BEGIN_MSG_MAP and END_MSG_MAP are not message loop, they are message maps. The function added between that macro will be called by the MFC framework when a message of corresponing type arrives in that window. The better method to explorer this type of thing is to step in to the code of MFC while debugging.

                  nave

                  H Offline
                  H Offline
                  HakunaMatada
                  wrote on last edited by
                  #8

                  Thanks for the info.

                  --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

                  1 Reply Last reply
                  0
                  • J jhwurmbach

                    HakunaMatada wrote:

                    o WS_POPUP style windows get created in a separate thread than the thread which created them or do they run in the same thread

                    Windows styles (like WS_POPUP) and threads are orthogonal concepts. WS_POPUP is about adorning your window (and maybe raising expectations in the user of your window). What you want to learn about is worker threads and UI threads! Maybe this[^] helps?


                    Failure is not an option - it's built right in.

                    H Offline
                    H Offline
                    HakunaMatada
                    wrote on last edited by
                    #9

                    Thanks.

                    --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

                    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