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. My Dialog-Window (not minimized), is hidden under other windows, how to make active/top/etc

My Dialog-Window (not minimized), is hidden under other windows, how to make active/top/etc

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
11 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.
  • O ohadp

    I've tried: ShowWindow(SW_SHOW); ActivateWindow(); SetForegroundWindow(); My window is a derived CDialog. What's missing ?

    A Offline
    A Offline
    Antony M Kancidrowski
    wrote on last edited by
    #2

    Use SetWindowPos() and the HWND_TOP flag for zorder.

    e.g.
    SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

    Ant.

    O 1 Reply Last reply
    0
    • O ohadp

      I've tried: ShowWindow(SW_SHOW); ActivateWindow(); SetForegroundWindow(); My window is a derived CDialog. What's missing ?

      J Offline
      J Offline
      jmkhael
      wrote on last edited by
      #3

      SetWindowPlacement SetWindowPos Papa while (TRUE) Papa.WillLove ( Bebe ) ;

      O 1 Reply Last reply
      0
      • A Antony M Kancidrowski

        Use SetWindowPos() and the HWND_TOP flag for zorder.

        e.g.
        SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

        Ant.

        O Offline
        O Offline
        ohadp
        wrote on last edited by
        #4

        This has no affect :-( The only thing that changes something is : SetForegroundWindow(); It makes my window's entry in the task-bar blink, but the window doesn't jump to the foreground. Perhaps this is privellege related, my call to SetForegroundWindow(); is done in response to a BroadcastSystemMessage with the BSF_ALLOWSFW flag. I don't thinks is the cause though as my window does start blinking...

        A 1 Reply Last reply
        0
        • J jmkhael

          SetWindowPlacement SetWindowPos Papa while (TRUE) Papa.WillLove ( Bebe ) ;

          O Offline
          O Offline
          ohadp
          wrote on last edited by
          #5

          I don't follow... SetWindowPos on itself didn't do the job...

          J 1 Reply Last reply
          0
          • O ohadp

            This has no affect :-( The only thing that changes something is : SetForegroundWindow(); It makes my window's entry in the task-bar blink, but the window doesn't jump to the foreground. Perhaps this is privellege related, my call to SetForegroundWindow(); is done in response to a BroadcastSystemMessage with the BSF_ALLOWSFW flag. I don't thinks is the cause though as my window does start blinking...

            A Offline
            A Offline
            Antony M Kancidrowski
            wrote on last edited by
            #6

            Strange!?! Could you please post a snip of your code where you are using this. Ant.

            O 1 Reply Last reply
            0
            • A Antony M Kancidrowski

              Strange!?! Could you please post a snip of your code where you are using this. Ant.

              O Offline
              O Offline
              ohadp
              wrote on last edited by
              #7

              Sender: Sure, snippet below. My guess is that my window-style or default-message-handling somehow affects this... But I can't point out exactly what. DWORD target = BSM_APPLICATIONS; BroadcastSystemMessage( BSF_ALLOWSFW | BSF_POSTMESSAGE, &target, m_guiMsgId, 0, 0); Receiver: Sure: if (IsIconic()) ShowWindow(SW_RESTORE); SetForegroundWindow();

              A 1 Reply Last reply
              0
              • O ohadp

                I don't follow... SetWindowPos on itself didn't do the job...

                J Offline
                J Offline
                jmkhael
                wrote on last edited by
                #8

                How did you call it? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                1 Reply Last reply
                0
                • O ohadp

                  Sender: Sure, snippet below. My guess is that my window-style or default-message-handling somehow affects this... But I can't point out exactly what. DWORD target = BSM_APPLICATIONS; BroadcastSystemMessage( BSF_ALLOWSFW | BSF_POSTMESSAGE, &target, m_guiMsgId, 0, 0); Receiver: Sure: if (IsIconic()) ShowWindow(SW_RESTORE); SetForegroundWindow();

                  A Offline
                  A Offline
                  Antony M Kancidrowski
                  wrote on last edited by
                  #9

                  OK, how did you call SetWindowPos() when you called it instead of SetForegroundWindow() ? Ant.

                  O 1 Reply Last reply
                  0
                  • A Antony M Kancidrowski

                    OK, how did you call SetWindowPos() when you called it instead of SetForegroundWindow() ? Ant.

                    O Offline
                    O Offline
                    ohadp
                    wrote on last edited by
                    #10

                    SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

                    A 1 Reply Last reply
                    0
                    • O ohadp

                      SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

                      A Offline
                      A Offline
                      Antony M Kancidrowski
                      wrote on last edited by
                      #11

                      Um, that is the correct syntax and should put the dialog on top. I can't think what would be preventing it in your situation. Ant. I'm hard, yet soft.
                      I'm coloured, yet clear.
                      I'm fuity and sweet.
                      I'm jelly, what am I?
                      - David Williams (Little Britain)

                      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