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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC dialog enigma - please help

MFC dialog enigma - please help

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++help
8 Posts 3 Posters 1 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.
  • B Offline
    B Offline
    Beer
    wrote on last edited by
    #1

    1. MFC dialog app is created 2. 2nd modeless dialog is created with extended style WS_EX_APPWINDOW, it's then shown and updated. The parent is set to null or desktop with SetParent(NULL) or SetParent(GetDesktopWindow()) 3. Main dialog window is minimized, and as it is, the taskbar space for the non-modal disappears and the non-modal dialog is also minimized 4. NO, i repeat NO messages at all are sent to the non-modal dialog such as you would expect (ex. WM_SIZE message). My Question is simple, what the heck is going on? How does one stop MFC from stealing the non-modal dialog's messages and reducing it automatically and removing it's taskbar space? So far no one has been able to answer this, and I've posted it a couple times. hey

    D H B 3 Replies Last reply
    0
    • B Beer

      1. MFC dialog app is created 2. 2nd modeless dialog is created with extended style WS_EX_APPWINDOW, it's then shown and updated. The parent is set to null or desktop with SetParent(NULL) or SetParent(GetDesktopWindow()) 3. Main dialog window is minimized, and as it is, the taskbar space for the non-modal disappears and the non-modal dialog is also minimized 4. NO, i repeat NO messages at all are sent to the non-modal dialog such as you would expect (ex. WM_SIZE message). My Question is simple, what the heck is going on? How does one stop MFC from stealing the non-modal dialog's messages and reducing it automatically and removing it's taskbar space? So far no one has been able to answer this, and I've posted it a couple times. hey

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Beer wrote: So far no one has been able to answer this, and I've posted it a couple times. Which might be an indication that no one has an answer.

      B 1 Reply Last reply
      0
      • B Beer

        1. MFC dialog app is created 2. 2nd modeless dialog is created with extended style WS_EX_APPWINDOW, it's then shown and updated. The parent is set to null or desktop with SetParent(NULL) or SetParent(GetDesktopWindow()) 3. Main dialog window is minimized, and as it is, the taskbar space for the non-modal disappears and the non-modal dialog is also minimized 4. NO, i repeat NO messages at all are sent to the non-modal dialog such as you would expect (ex. WM_SIZE message). My Question is simple, what the heck is going on? How does one stop MFC from stealing the non-modal dialog's messages and reducing it automatically and removing it's taskbar space? So far no one has been able to answer this, and I've posted it a couple times. hey

        H Offline
        H Offline
        Hans Ruck
        wrote on last edited by
        #3

        The behaviour you are talking about is by default. To solve the problem you could create your modeless directly as the child of the desktop window. Then you would need to manage the communication between the dialogs wich, i'm afraid, could raise some problems. rechi

        B 1 Reply Last reply
        0
        • D David Crow

          Beer wrote: So far no one has been able to answer this, and I've posted it a couple times. Which might be an indication that no one has an answer.

          B Offline
          B Offline
          Beer
          wrote on last edited by
          #4

          DavidCrow wrote: Which might be an indication that no one has an answer I guess I was secretly hoping somebody was going to pull out their secret MFC internal mapping chart they swiped from the MS complex in Washington and answer this eventually, but alas, it doesn't seem to be happening :( hey

          1 Reply Last reply
          0
          • H Hans Ruck

            The behaviour you are talking about is by default. To solve the problem you could create your modeless directly as the child of the desktop window. Then you would need to manage the communication between the dialogs wich, i'm afraid, could raise some problems. rechi

            B Offline
            B Offline
            Beer
            wrote on last edited by
            #5

            directly how? you mean without using a dialog resource, or without using CDialog? My modeless dialogs are already made with CDialog, and it would be an overhaul to change them. Is there some way to intercept MFC and selectively stop it's internal message handling? hey

            H 1 Reply Last reply
            0
            • B Beer

              directly how? you mean without using a dialog resource, or without using CDialog? My modeless dialogs are already made with CDialog, and it would be an overhaul to change them. Is there some way to intercept MFC and selectively stop it's internal message handling? hey

              H Offline
              H Offline
              Hans Ruck
              wrote on last edited by
              #6

              Beer wrote: Is there some way to intercept MFC and selectively stop it's internal message handling? Theoretically it is possible by intercepting PreTranslateMessage but i don't know if it works in this case. Beer wrote: directly how? Check this sample:

              CModelessDlg *pdlg=new CModelessDlg;

              CWnd *pMan=new CWnd;
              pMan->Attach(::GetDesktopWindow());
              pdlg->Create(IDD_DIALOG_MODELESS, pMan); // pMan has the desktop window
              pMan->Detach();
              delete pMan;
              pdlg->ModifyStyleEx(0, WS_EX_APPWINDOW);
              pdlg->ShowWindow(SW_SHOW);

              where CModelessDlg is the CDialog derived. You have to manage the pdlg pointer X| rechi

              B 1 Reply Last reply
              0
              • B Beer

                1. MFC dialog app is created 2. 2nd modeless dialog is created with extended style WS_EX_APPWINDOW, it's then shown and updated. The parent is set to null or desktop with SetParent(NULL) or SetParent(GetDesktopWindow()) 3. Main dialog window is minimized, and as it is, the taskbar space for the non-modal disappears and the non-modal dialog is also minimized 4. NO, i repeat NO messages at all are sent to the non-modal dialog such as you would expect (ex. WM_SIZE message). My Question is simple, what the heck is going on? How does one stop MFC from stealing the non-modal dialog's messages and reducing it automatically and removing it's taskbar space? So far no one has been able to answer this, and I've posted it a couple times. hey

                B Offline
                B Offline
                Beer
                wrote on last edited by
                #7

                AHHHH!!! I finally got it, you have to create the dialog with the desktop as the parent and not set it as the parent later dlg->Create(IDD_DIALOG, GetDesktopWindow()); Boy do i feel stupid :wtf: hey

                1 Reply Last reply
                0
                • H Hans Ruck

                  Beer wrote: Is there some way to intercept MFC and selectively stop it's internal message handling? Theoretically it is possible by intercepting PreTranslateMessage but i don't know if it works in this case. Beer wrote: directly how? Check this sample:

                  CModelessDlg *pdlg=new CModelessDlg;

                  CWnd *pMan=new CWnd;
                  pMan->Attach(::GetDesktopWindow());
                  pdlg->Create(IDD_DIALOG_MODELESS, pMan); // pMan has the desktop window
                  pMan->Detach();
                  delete pMan;
                  pdlg->ModifyStyleEx(0, WS_EX_APPWINDOW);
                  pdlg->ShowWindow(SW_SHOW);

                  where CModelessDlg is the CDialog derived. You have to manage the pdlg pointer X| rechi

                  B Offline
                  B Offline
                  Beer
                  wrote on last edited by
                  #8

                  rechi, thanks for all your help, apparently it had to be created with the desktop window pointer. hey

                  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