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. Dialog Box

Dialog Box

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
9 Posts 2 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.
  • S Offline
    S Offline
    syedhassan4
    wrote on last edited by
    #1

    In Dialog base(MFC) application. I Create second Dialog (I have Seperate Class for that Dialog) OnInitDialog() through Create(IDD_DLG, this); So It becomes Modless Dialog. Problem is that when Second Dialog(Child) when Display it is above of First Dialog(Parent).(as it should be b/c it is Current Focus) I need when First Dialog(Parent) is Clicked(Focused) it becomes above of Second Dialog (Child). and when Second Dialog (Child) is Clicked(Focused) it becomes above of First Dialog(Parent). I try to use SetWindowPos(). But did not work. Like following SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); ::SetWindowPos(AfxGetApp()->GetMainWnd()->m_hWnd, HWND_TOPMOST, 0, 0, 0,0, SWP_NOMOVE | SWP_NOSIZE); I also need to know which event occure when any Dialog get Focus (active). Even Clicked on the System Menu. WM_PAINT WM_SETFOCUS GetFocus I check all all these messages. They are not :confused: Some code will be helped alot . . . Thanks in advance. :confused: :confused: :confused:

    C 1 Reply Last reply
    0
    • S syedhassan4

      In Dialog base(MFC) application. I Create second Dialog (I have Seperate Class for that Dialog) OnInitDialog() through Create(IDD_DLG, this); So It becomes Modless Dialog. Problem is that when Second Dialog(Child) when Display it is above of First Dialog(Parent).(as it should be b/c it is Current Focus) I need when First Dialog(Parent) is Clicked(Focused) it becomes above of Second Dialog (Child). and when Second Dialog (Child) is Clicked(Focused) it becomes above of First Dialog(Parent). I try to use SetWindowPos(). But did not work. Like following SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); ::SetWindowPos(AfxGetApp()->GetMainWnd()->m_hWnd, HWND_TOPMOST, 0, 0, 0,0, SWP_NOMOVE | SWP_NOSIZE); I also need to know which event occure when any Dialog get Focus (active). Even Clicked on the System Menu. WM_PAINT WM_SETFOCUS GetFocus I check all all these messages. They are not :confused: Some code will be helped alot . . . Thanks in advance. :confused: :confused: :confused:

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You're creating the second as the child of the first. Try making the parent window NULL, or create both dialogs as children of a main dialog, which is not visible. Use Spy++ to see all the messages sent when a dialog becomes active. I believe the one you want specifically is WM_CAPTURECHANGED Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

      S 1 Reply Last reply
      0
      • C Christian Graus

        You're creating the second as the child of the first. Try making the parent window NULL, or create both dialogs as children of a main dialog, which is not visible. Use Spy++ to see all the messages sent when a dialog becomes active. I believe the one you want specifically is WM_CAPTURECHANGED Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

        S Offline
        S Offline
        syedhassan4
        wrote on last edited by
        #3

        And How Can I do this. By SetParent(NULL). It does not work. Thanks for WM_CAPTURECHANGED. But still I my problem not solve. I explain further what I need below. As you know User can active Window By Clicking on the Title Bar of Dialog or My Clicking Dilog box itself(Client area). I need only Single event to monitor this. Is there any material to use Spy++ (because I do not know effectively it). Thanks. :confused: :confused: :confused:

        C 1 Reply Last reply
        0
        • S syedhassan4

          And How Can I do this. By SetParent(NULL). It does not work. Thanks for WM_CAPTURECHANGED. But still I my problem not solve. I explain further what I need below. As you know User can active Window By Clicking on the Title Bar of Dialog or My Clicking Dilog box itself(Client area). I need only Single event to monitor this. Is there any material to use Spy++ (because I do not know effectively it). Thanks. :confused: :confused: :confused:

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          You specify the parent in your Create call. I am using WM_CAPTURECHANGED to do exactly the same thing, and it works every way I can set the focus on my window. Spy++ isn't hard, you just choose Find Window, select the Window and watch the messages come up. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

          S 1 Reply Last reply
          0
          • C Christian Graus

            You specify the parent in your Create call. I am using WM_CAPTURECHANGED to do exactly the same thing, and it works every way I can set the focus on my window. Spy++ isn't hard, you just choose Find Window, select the Window and watch the messages come up. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

            S Offline
            S Offline
            syedhassan4
            wrote on last edited by
            #5

            Some Code will helped alot. I am trying my best but could not achieved. :confused: I will try later with Spy++. Thanks.

            C 1 Reply Last reply
            0
            • S syedhassan4

              Some Code will helped alot. I am trying my best but could not achieved. :confused: I will try later with Spy++. Thanks.

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              The CDialog Create method takes two parameters:

              BOOL Create(
              LPCTSTR lpszTemplateName,
              CWnd* pParentWnd = NULL );

              Because the second defaults to NULL, it may not be getting set otherwise. I create modeless dialogs by putting the following in the constructor

              if (Create(pParent, IDD)) ShowWindow(SW_SHOW)

              Then I only need to create a dialog like this

              CMyDialog dlg(this);

              and the pointer to the window class I am in is passed as the parent, preserving the relationship I need to get the window of the child always above the parent. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

              S 1 Reply Last reply
              0
              • C Christian Graus

                The CDialog Create method takes two parameters:

                BOOL Create(
                LPCTSTR lpszTemplateName,
                CWnd* pParentWnd = NULL );

                Because the second defaults to NULL, it may not be getting set otherwise. I create modeless dialogs by putting the following in the constructor

                if (Create(pParent, IDD)) ShowWindow(SW_SHOW)

                Then I only need to create a dialog like this

                CMyDialog dlg(this);

                and the pointer to the window class I am in is passed as the parent, preserving the relationship I need to get the window of the child always above the parent. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

                S Offline
                S Offline
                syedhassan4
                wrote on last edited by
                #7

                Please Check my question. I need that which Dialog is Active should be Front of Another. I already checked this but this is not working. :confused: :confused: :confused: Thanks. If sample Application(in Zip form) send.:-O

                C 1 Reply Last reply
                0
                • S syedhassan4

                  Please Check my question. I need that which Dialog is Active should be Front of Another. I already checked this but this is not working. :confused: :confused: :confused: Thanks. If sample Application(in Zip form) send.:-O

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  In that case, the logical thing is to make both windows children of a third window, even if that third window is very small, or hidden. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

                  S 1 Reply Last reply
                  0
                  • C Christian Graus

                    In that case, the logical thing is to make both windows children of a third window, even if that third window is very small, or hidden. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

                    S Offline
                    S Offline
                    syedhassan4
                    wrote on last edited by
                    #9

                    Thanks for idea. I will try it.

                    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