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. HWND_TOP to make a dialog topmost???

HWND_TOP to make a dialog topmost???

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

    Hi, i need some help to bring a dialog to top, but only for him parent dialog. I use this to set child dialog on the top, but he still on top for all applications:

    ::SetWindowPos(pWaitDlg->m_hWnd, HWND_TOP,0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);

    but i need it to be only for him's parent dialog on top, not for all, this is a small dialog with progressbar on it! Thanks for any help!! Arrin

    K I 2 Replies Last reply
    0
    • A Arrin

      Hi, i need some help to bring a dialog to top, but only for him parent dialog. I use this to set child dialog on the top, but he still on top for all applications:

      ::SetWindowPos(pWaitDlg->m_hWnd, HWND_TOP,0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);

      but i need it to be only for him's parent dialog on top, not for all, this is a small dialog with progressbar on it! Thanks for any help!! Arrin

      K Offline
      K Offline
      KingsGambit
      wrote on last edited by
      #2

      I think you can try giving handle to the parent window instead of HWND_TOP as second parameter.

      A 1 Reply Last reply
      0
      • A Arrin

        Hi, i need some help to bring a dialog to top, but only for him parent dialog. I use this to set child dialog on the top, but he still on top for all applications:

        ::SetWindowPos(pWaitDlg->m_hWnd, HWND_TOP,0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);

        but i need it to be only for him's parent dialog on top, not for all, this is a small dialog with progressbar on it! Thanks for any help!! Arrin

        I Offline
        I Offline
        Iain Clarke Warrior Programmer
        wrote on last edited by
        #3

        From the msdn page for SetWindowPos: http://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx, HWND_NOTOPMOST Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window. This sounds a lot like what you want. Iain.

        I have now moved to Sweden for love (awwww).

        A 1 Reply Last reply
        0
        • K KingsGambit

          I think you can try giving handle to the parent window instead of HWND_TOP as second parameter.

          A Offline
          A Offline
          Arrin
          wrote on last edited by
          #4

          Hi, thanks for answer, that is! Only one issue is there :), first here is code:

          CProgressDlg dlgProgress; // simple dialog with progressbar
          dlgProgress.Create(CProgressDlg::IDD, GetDesktopWindow());
          this->EnableWindow(FALSE); // disable parent window to make him unclickable
          ::SetWindowPos(dlgProgress.m_hWnd, this->m_hWnd,0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
          dlgProgress.ShowWindow(SW_SHOW); // show new dialog
          dlgProgress.CenterWindow(); // center him
          dlgProgress.BringWindowToTop(); // bring it to top, because after create they is in the background of the parent dialog, don't know why!!?

          There is only one thing that is not ok, i can switch between this two dialogs if i click they icons in the taskbar, in this case is this little "dlgProgress"(simple Dialog with progressbar) Dialog in the background of hims parent(if i click on parent icon), and that is what i need to avoid! This little dlgProgress must be on top of hims parent until the process is finish! :( Thanks for help! Arrin

          K 1 Reply Last reply
          0
          • I Iain Clarke Warrior Programmer

            From the msdn page for SetWindowPos: http://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx, HWND_NOTOPMOST Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window. This sounds a lot like what you want. Iain.

            I have now moved to Sweden for love (awwww).

            A Offline
            A Offline
            Arrin
            wrote on last edited by
            #5

            Hi, thanks for answer! Still need help! regards Arrin!

            I 1 Reply Last reply
            0
            • A Arrin

              Hi, thanks for answer! Still need help! regards Arrin!

              I Offline
              I Offline
              Iain Clarke Warrior Programmer
              wrote on last edited by
              #6

              Arrin wrote:

              Still need help!

              Then I need a question to help with! Did my answer not solve your problem? Did you realise you asked the wrong question? Was my answer complete rubbish? Iain.

              I have now moved to Sweden for love (awwww).

              1 Reply Last reply
              0
              • A Arrin

                Hi, thanks for answer, that is! Only one issue is there :), first here is code:

                CProgressDlg dlgProgress; // simple dialog with progressbar
                dlgProgress.Create(CProgressDlg::IDD, GetDesktopWindow());
                this->EnableWindow(FALSE); // disable parent window to make him unclickable
                ::SetWindowPos(dlgProgress.m_hWnd, this->m_hWnd,0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
                dlgProgress.ShowWindow(SW_SHOW); // show new dialog
                dlgProgress.CenterWindow(); // center him
                dlgProgress.BringWindowToTop(); // bring it to top, because after create they is in the background of the parent dialog, don't know why!!?

                There is only one thing that is not ok, i can switch between this two dialogs if i click they icons in the taskbar, in this case is this little "dlgProgress"(simple Dialog with progressbar) Dialog in the background of hims parent(if i click on parent icon), and that is what i need to avoid! This little dlgProgress must be on top of hims parent until the process is finish! :( Thanks for help! Arrin

                K Offline
                K Offline
                KingsGambit
                wrote on last edited by
                #7

                May be you can remove the call to GetDesktopWindow(). I think dlgProgress.Create(CProgressDlg::IDD) would be enough. In addition to that, I suppose dlgProgress has to be a member of the parent dialog.

                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