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. Small doubt

Small doubt

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

    Hi, Can any one tell me how to differentiate messagebox dialog from other dialogs. Thanks in advance.:)

    C N T 3 Replies Last reply
    0
    • K kuttiam

      Hi, Can any one tell me how to differentiate messagebox dialog from other dialogs. Thanks in advance.:)

      C Offline
      C Offline
      chandu004
      wrote on last edited by
      #2

      why do you have any of your dialogs which look like messagebox?

      1 Reply Last reply
      0
      • K kuttiam

        Hi, Can any one tell me how to differentiate messagebox dialog from other dialogs. Thanks in advance.:)

        N Offline
        N Offline
        Nelek
        wrote on last edited by
        #3

        As the MessageBox comes from CWnd and CDialog is a CWnd derived class but "independant" you can try

        CDialog* pDlg = (CDialog*) GetActiveWindow ();
        if (pDlg->IsKindOf(RUNTIME_CLASS(CDialog)))
        //you have a dialog
        else
        //you have another thing, maybe a messagebox, maybe a view, maybe a window

        Another way to do the difference is the first member of both possibilites. By MessageBox the first member is a handler o a window hWnd, and in a DialogBox this handler is of the application instance hInstance Hope it helps

        Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you ;)

        K 1 Reply Last reply
        0
        • K kuttiam

          Hi, Can any one tell me how to differentiate messagebox dialog from other dialogs. Thanks in advance.:)

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          kuttiam wrote:

          Can any one tell me how to differentiate messagebox dialog from other dialogs.

          MessageBox is type of dialog. but you don't need template to create it as it required by Dialog. plus a single api call i.e. MessageBox will create the message box for you!

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
          Never mind - my own stupidity is the source of every "problem" - Mixture

          cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

          1 Reply Last reply
          0
          • N Nelek

            As the MessageBox comes from CWnd and CDialog is a CWnd derived class but "independant" you can try

            CDialog* pDlg = (CDialog*) GetActiveWindow ();
            if (pDlg->IsKindOf(RUNTIME_CLASS(CDialog)))
            //you have a dialog
            else
            //you have another thing, maybe a messagebox, maybe a view, maybe a window

            Another way to do the difference is the first member of both possibilites. By MessageBox the first member is a handler o a window hWnd, and in a DialogBox this handler is of the application instance hInstance Hope it helps

            Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you ;)

            K Offline
            K Offline
            kuttiam
            wrote on last edited by
            #5

            Hi, Thanks for ur reply. I am trying to write a message box hook. In that i need to differentiate the message box from other windows and dialogs. I tried your suggestion but i could not achieve that :((. I appreciate your help.:)

            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