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. Creating a window without focus [modified]

Creating a window without focus [modified]

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

    Hey guys. First things first, i am using MFC. Ok, the question is, what is the best way to create a new window so this new window will not receive a focus? Its like this: i got a simple dialog box app and a button on it. When i click a button, it creates a new window, without any caption, just a popup window (WS_POPUP). But this little popup wnd gets focus and i dont want this. I want it be created but the focus should stay on Dialog box window. Besides, if i move a mouse or click on this popup window - it should not receive a focus, it should be kinda "focusless" - no matter what you do - it should not receive any focus ever. How this can be done? Edit: Maybe i should rephrase a little bit: this popup sets itself as foreground window, dialog box window should stay as foreground, not popup window Thanks

    011011010110000101100011011010000110100101101110 0110010101110011

    modified on Sunday, May 15, 2011 8:33 AM

    L A 2 Replies Last reply
    0
    • C csrss

      Hey guys. First things first, i am using MFC. Ok, the question is, what is the best way to create a new window so this new window will not receive a focus? Its like this: i got a simple dialog box app and a button on it. When i click a button, it creates a new window, without any caption, just a popup window (WS_POPUP). But this little popup wnd gets focus and i dont want this. I want it be created but the focus should stay on Dialog box window. Besides, if i move a mouse or click on this popup window - it should not receive a focus, it should be kinda "focusless" - no matter what you do - it should not receive any focus ever. How this can be done? Edit: Maybe i should rephrase a little bit: this popup sets itself as foreground window, dialog box window should stay as foreground, not popup window Thanks

      011011010110000101100011011010000110100101101110 0110010101110011

      modified on Sunday, May 15, 2011 8:33 AM

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      isn't that what enabled/disabled is for? Not sure how to do it in MFC, but that is what I would have a look at. :)

      Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

      C 1 Reply Last reply
      0
      • L Luc Pattyn

        isn't that what enabled/disabled is for? Not sure how to do it in MFC, but that is what I would have a look at. :)

        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

        C Offline
        C Offline
        csrss
        wrote on last edited by
        #3

        Nope.

        011011010110000101100011011010000110100101101110 0110010101110011

        1 Reply Last reply
        0
        • C csrss

          Hey guys. First things first, i am using MFC. Ok, the question is, what is the best way to create a new window so this new window will not receive a focus? Its like this: i got a simple dialog box app and a button on it. When i click a button, it creates a new window, without any caption, just a popup window (WS_POPUP). But this little popup wnd gets focus and i dont want this. I want it be created but the focus should stay on Dialog box window. Besides, if i move a mouse or click on this popup window - it should not receive a focus, it should be kinda "focusless" - no matter what you do - it should not receive any focus ever. How this can be done? Edit: Maybe i should rephrase a little bit: this popup sets itself as foreground window, dialog box window should stay as foreground, not popup window Thanks

          011011010110000101100011011010000110100101101110 0110010101110011

          modified on Sunday, May 15, 2011 8:33 AM

          A Offline
          A Offline
          Alain Rist
          wrote on last edited by
          #4

          Hi, Your popup should handle WM_ACTIVATE with:

          if (wParam != WA_INACTIVE)
          ::SetActiveWindow(::GetParent(GetSafeHwnd()));

          cheers, AR

          When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)

          C 1 Reply Last reply
          0
          • A Alain Rist

            Hi, Your popup should handle WM_ACTIVATE with:

            if (wParam != WA_INACTIVE)
            ::SetActiveWindow(::GetParent(GetSafeHwnd()));

            cheers, AR

            When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)

            C Offline
            C Offline
            csrss
            wrote on last edited by
            #5

            Thank you!

            011011010110000101100011011010000110100101101110 0110010101110011

            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