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. How to fix a window at the top?

How to fix a window at the top?

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelptutorial
7 Posts 4 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.
  • I Offline
    I Offline
    iayd
    wrote on last edited by
    #1

    Hi, When I create the dialog box (second dialog) in the first dialog box it stays always above the first one. I can push to a button in the first dialog box while the second one stays above it.But when I create them at the begining of the program in the main dialog box (main dialog box is different than the first dialog box) then if I touch to the first dialog box the second one goes below the first one.How can I fix the second dialog box above the first dialog box when I create them at the beginning of the program? Thanks ibrahim

    L A 2 Replies Last reply
    0
    • I iayd

      Hi, When I create the dialog box (second dialog) in the first dialog box it stays always above the first one. I can push to a button in the first dialog box while the second one stays above it.But when I create them at the begining of the program in the main dialog box (main dialog box is different than the first dialog box) then if I touch to the first dialog box the second one goes below the first one.How can I fix the second dialog box above the first dialog box when I create them at the beginning of the program? Thanks ibrahim

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      You change the Z order[^] to Topmost.

      led mike

      A 1 Reply Last reply
      0
      • I iayd

        Hi, When I create the dialog box (second dialog) in the first dialog box it stays always above the first one. I can push to a button in the first dialog box while the second one stays above it.But when I create them at the begining of the program in the main dialog box (main dialog box is different than the first dialog box) then if I touch to the first dialog box the second one goes below the first one.How can I fix the second dialog box above the first dialog box when I create them at the beginning of the program? Thanks ibrahim

        A Offline
        A Offline
        Alan Balkany
        wrote on last edited by
        #3

        If you use DoModal () to display the second dialog box, it will be fixed at the top until you close it. This is called a "modal" dialog box.

        I 1 Reply Last reply
        0
        • A Alan Balkany

          If you use DoModal () to display the second dialog box, it will be fixed at the top until you close it. This is called a "modal" dialog box.

          I Offline
          I Offline
          iayd
          wrote on last edited by
          #4

          But I want that I can push a button or write something to an editbox in the first dialog box while the second dialog is on the top.When I create the dialog box as modal I think that I cannot use the first dialog box?

          A 1 Reply Last reply
          0
          • I iayd

            But I want that I can push a button or write something to an editbox in the first dialog box while the second dialog is on the top.When I create the dialog box as modal I think that I cannot use the first dialog box?

            A Offline
            A Offline
            Alan Balkany
            wrote on last edited by
            #5

            That's correct. In that case, you should probably use led mike's suggestion instead of DoModal ().

            1 Reply Last reply
            0
            • L led mike

              You change the Z order[^] to Topmost.

              led mike

              A Offline
              A Offline
              aks
              wrote on last edited by
              #6

              As mike said, u can use SetWindowPos( m_hWnd, HWND_TOPMOST, Left, Top, Width, Height, SWP_SHOWWINDOW );

              aks

              I 1 Reply Last reply
              0
              • A aks

                As mike said, u can use SetWindowPos( m_hWnd, HWND_TOPMOST, Left, Top, Width, Height, SWP_SHOWWINDOW );

                aks

                I Offline
                I Offline
                iayd
                wrote on last edited by
                #7

                That didn't solve my problem.I think it will be better if I write the code sample. Creating the dialogs as global.

                pKeyboard = new CKeyboard;
                pKeyboard->Create(IDD_KEYBOARD,this);
                ::SetWindowPos(pKeyboard->m_hWnd, HWND_TOPMOST,0,0,cxScreen,2*cyScreen/5, SWP_SHOWWINDOW );

                pPhoneEditor = new CPhoneEditor;
                pPhoneEditor->Create(IDD_PHONEEDITOR,this);
                pPhoneEditor->SetWindowPos(&wndTop,0,0,cxScreen,cyScreen,SWP_HIDEWINDOW);

                Is there a problem in this code?

                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