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. how to create dialogs in Console application

how to create dialogs in Console application

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++
14 Posts 10 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.
  • C Cedric Moonen

    I don't get it. If you need dialogs, why don't you create a win32 application instead :doh: ?

    Cédric Moonen Software developer
    Charting control [v3.0] OpenGL game tutorial in C++

    M Offline
    M Offline
    manoharbalu
    wrote on last edited by
    #4

    I already have a console application in which I want to create my dialog. If I tried to create a dialog resource and then add a class to the dialog through class wizard as in MFC it gives me errors due to #define "StdAfx.H" which is included in the new dialog class created through wizard. And also its not able to recogonize the MFC classes.

    1 Reply Last reply
    0
    • S Stephen Hewitt

      Just as you normally would. What's the specific problem?

      Steve

      M Offline
      M Offline
      manoharbalu
      wrote on last edited by
      #5

      If I tried to create a dialog resource and then add a class to the dialog through class wizard as in MFC it gives me errors due to #define "StdAfx.H" which is included in the new dialog class created through wizard. And also its not able to recogonize the MFC classes and gives errors.

      S S 2 Replies Last reply
      0
      • M manoharbalu

        Please provide me step by step how to create a number of dialogs in a Console application I also need to respond to the events in the dialogs as in MFC.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #6

        I don't think Visual Studio is set up to do this. If you want to use MFC then you should either create an MFC Windows app that contains the dialogs, or an MFC dialog app with tabs or some similar mechanism. If you want to add dialogs to a console app then you will need to do it manually, by adding all the required Win32/MFC framework components.

        It's time for a new signature.

        1 Reply Last reply
        0
        • M manoharbalu

          If I tried to create a dialog resource and then add a class to the dialog through class wizard as in MFC it gives me errors due to #define "StdAfx.H" which is included in the new dialog class created through wizard. And also its not able to recogonize the MFC classes and gives errors.

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

          The author of this article attached a console to a MFC CMainFrame using AllocConsole(). Creating a console for your MFC app's debug output Creating a console for your MFC app's debug output

          D 1 Reply Last reply
          0
          • M manoharbalu

            Please provide me step by step how to create a number of dialogs in a Console application I also need to respond to the events in the dialogs as in MFC.

            P Offline
            P Offline
            Parthiban
            wrote on last edited by
            #8

            In a console based application, we cant include the dialog which is created by MFC or SDK. If u still need to use the dialog in console application, convert the your console application to win32 application and try to use MFC dialogs. ---Parthi

            R 1 Reply Last reply
            0
            • C Cedric Moonen

              I don't get it. If you need dialogs, why don't you create a win32 application instead :doh: ?

              Cédric Moonen Software developer
              Charting control [v3.0] OpenGL game tutorial in C++

              F Offline
              F Offline
              Fareed Rizkalla
              wrote on last edited by
              #9

              I believe he wants to mimic the logic of old DOS GUI. :omg:

              1 Reply Last reply
              0
              • P Parthiban

                In a console based application, we cant include the dialog which is created by MFC or SDK. If u still need to use the dialog in console application, convert the your console application to win32 application and try to use MFC dialogs. ---Parthi

                R Offline
                R Offline
                Rajesh R Subramanian
                wrote on last edited by
                #10

                Parthiban wrote:

                In a console based application, we cant include the dialog which is created by MFC or SDK.

                Wrong. You could have a console based application support MFC by including the right header files.

                “Follow your bliss.” – Joseph Campbell

                1 Reply Last reply
                0
                • S Software_Developer

                  The author of this article attached a console to a MFC CMainFrame using AllocConsole(). Creating a console for your MFC app's debug output Creating a console for your MFC app's debug output

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

                  Which is the opposite of what the OP wanted, yes?

                  "One man's wage rise is another man's price increase." - Harold Wilson

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  "Man who follows car will be exhausted." - Confucius

                  S 1 Reply Last reply
                  0
                  • D David Crow

                    Which is the opposite of what the OP wanted, yes?

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    "Man who follows car will be exhausted." - Confucius

                    S Offline
                    S Offline
                    Software_Developer
                    wrote on last edited by
                    #12

                    Im wrong.

                    1 Reply Last reply
                    0
                    • M manoharbalu

                      If I tried to create a dialog resource and then add a class to the dialog through class wizard as in MFC it gives me errors due to #define "StdAfx.H" which is included in the new dialog class created through wizard. And also its not able to recogonize the MFC classes and gives errors.

                      S Offline
                      S Offline
                      Stephen Hewitt
                      wrote on last edited by
                      #13

                      Post the errors.

                      Steve

                      1 Reply Last reply
                      0
                      • M manoharbalu

                        Please provide me step by step how to create a number of dialogs in a Console application I also need to respond to the events in the dialogs as in MFC.

                        J Offline
                        J Offline
                        Joe Woodbury
                        wrote on last edited by
                        #14

                        Sounds like you didn't create the console application with the MFC app wizard, so the pre-compiled header settings are not set correctly. You also technically need to initialize MFC in main, though this isn't actually required for some parts of MFC (which I used to worry about in the days of very limited memory, but haven't for years.)

                        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