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. Easy menu/modal dialog question

Easy menu/modal dialog question

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 3 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.
  • P Offline
    P Offline
    philliad
    wrote on last edited by
    #1

    In an application I'm making I need to use a menu to launch a modal dialog box. I seem to be struggling a bit with this task. How do I do it?!?! Thanks! Phillip

    J M P 3 Replies Last reply
    0
    • P philliad

      In an application I'm making I need to use a menu to launch a modal dialog box. I seem to be struggling a bit with this task. How do I do it?!?! Thanks! Phillip

      J Offline
      J Offline
      Johan Rosengren
      wrote on last edited by
      #2

      Hm, you handle the menu selection (add a handler with the Class Wizard if you use MSVC++ 6.0 ). In the handler, you declare a variable of the dialog class. Then, you call DoModal on the variable.

      1 Reply Last reply
      0
      • P philliad

        In an application I'm making I need to use a menu to launch a modal dialog box. I seem to be struggling a bit with this task. How do I do it?!?! Thanks! Phillip

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        the menu part or the dialog part ? did you create your dialog ? in the resources and in the code ( generated by the wizard ) did you add the menu item ( in the resources ) ? did you create an handler for the menu item ? ( can be created from the wizard )


        Maximilien Lincourt Your Head A Splode - Strong Bad

        P 1 Reply Last reply
        0
        • M Maximilien

          the menu part or the dialog part ? did you create your dialog ? in the resources and in the code ( generated by the wizard ) did you add the menu item ( in the resources ) ? did you create an handler for the menu item ? ( can be created from the wizard )


          Maximilien Lincourt Your Head A Splode - Strong Bad

          P Offline
          P Offline
          philliad
          wrote on last edited by
          #4

          I've made the menu, made the handler for the menu item, and made the actual dialog box (and a corresponding class). I'm having trouble making an instance of the dialog class and calling DoModal for some reason. It's quite baffling, actually. Phillip

          J 1 Reply Last reply
          0
          • P philliad

            I've made the menu, made the handler for the menu item, and made the actual dialog box (and a corresponding class). I'm having trouble making an instance of the dialog class and calling DoModal for some reason. It's quite baffling, actually. Phillip

            J Offline
            J Offline
            Johan Rosengren
            wrote on last edited by
            #5

            #include "MyDialogClass.h" //... CXXX::OnSomething() { CMyDialogClass dialog; dialog.DoModal(); }

            P 1 Reply Last reply
            0
            • P philliad

              In an application I'm making I need to use a menu to launch a modal dialog box. I seem to be struggling a bit with this task. How do I do it?!?! Thanks! Phillip

              P Offline
              P Offline
              philliad
              wrote on last edited by
              #6

              error C2065: 'CDialogRates' : undeclared identifier It doesn't seem to recognize CDialogRates as a valid class. :mad: Phillip

              1 Reply Last reply
              0
              • J Johan Rosengren

                #include "MyDialogClass.h" //... CXXX::OnSomething() { CMyDialogClass dialog; dialog.DoModal(); }

                P Offline
                P Offline
                philliad
                wrote on last edited by
                #7

                Fixed it! Thanks. (I didn't include the header -duh!) Phillip

                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