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. Is my App displaying a message box?

Is my App displaying a message box?

Scheduled Pinned Locked Moved C / C++ / MFC
questiondesignlearning
5 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.
  • B Offline
    B Offline
    Bamaco2
    wrote on last edited by
    #1

    I want to know (programatically, of course: I am not blind!) if my application is displaying a MessageBox() or otherwise engaged in a modal dialog. The context of the question is this: I am in a CView* and I want to do something to the user interface. I need to know if my application is "busy" waiting for a modal dialog before I can proceed with my changes ??? I have tried GetActiveView() and it tells me if "this" view is the current "top" view. (I run modal loops in my views) so this is coverd. I am about to try GetFocus() then GetOwnerWnd()... Maybe someone already has the answer??

    B 1 Reply Last reply
    0
    • B Bamaco2

      I want to know (programatically, of course: I am not blind!) if my application is displaying a MessageBox() or otherwise engaged in a modal dialog. The context of the question is this: I am in a CView* and I want to do something to the user interface. I need to know if my application is "busy" waiting for a modal dialog before I can proceed with my changes ??? I have tried GetActiveView() and it tells me if "this" view is the current "top" view. (I run modal loops in my views) so this is coverd. I am about to try GetFocus() then GetOwnerWnd()... Maybe someone already has the answer??

      B Offline
      B Offline
      Bamaco2
      wrote on last edited by
      #2

      I got it, I think! GetLastActivePopup() I wonder where I was for the last XX years, I tought I knew WIN32. It goes to show, you learn something every day!

      B 1 Reply Last reply
      0
      • B Bamaco2

        I got it, I think! GetLastActivePopup() I wonder where I was for the last XX years, I tought I knew WIN32. It goes to show, you learn something every day!

        B Offline
        B Offline
        Bamaco2
        wrote on last edited by
        #3

        OOps. this is not good: GetLastActivePopup() still returns my VIEW's HWND instead of that of the MessageBox() :( I guess I can either (a) keep looking or (b) find someone smarter than me to give me the answer!

        L 1 Reply Last reply
        0
        • B Bamaco2

          OOps. this is not good: GetLastActivePopup() still returns my VIEW's HWND instead of that of the MessageBox() :( I guess I can either (a) keep looking or (b) find someone smarter than me to give me the answer!

          L Offline
          L Offline
          l a u r e n
          wrote on last edited by
          #4

          ummmmm why dont u set a variable in the calling view or doc class when the dialog pops up and clear it when it goes away?


          "there is no spoon"
          biz stuff about me

          B 1 Reply Last reply
          0
          • L l a u r e n

            ummmmm why dont u set a variable in the calling view or doc class when the dialog pops up and clear it when it goes away?


            "there is no spoon"
            biz stuff about me

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

            I tapught about that. The problem is that ma application has maybe 100 views or screens, and I want beautiful code, not a quick hack. Whatever would force me to spend lots of time working like a robot is not a great idea. I may capture all invokation of message boxes and dialog boxes, but as I (or someone else) maintain my applicatio, I am scared to "forget" about it. If I could use WIN32 to tell me is a messagebox is up and running, I write once and can rely on that no matter how my stuff is written, putting the logic in a base-class somewhere.

            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