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. void main

void main

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
16 Posts 8 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.
  • D dreamerzz

    Hi, For a normal Visual C++ program, we have a void main. But in creating a MFC single document interface, does anyone know which function is something similar to void main? Thanks for ur help

    J Offline
    J Offline
    Joan M
    wrote on last edited by
    #7

    Argh... the internet connection failed just when I posted the first answer... :mad: well... X| lets do it again... You can do it in three ways: -> if you don't need to do anything to the GUI you can use the InitInstance function in the main class. -> if you need to interact with the main frame (the SDI document view container) you can do it in the precreatewindow function in the mainframe class. -> if you need to interact with the view you can do it in the precreatewindow of the view class. hope this helps...

    https://www.robotecnik.com freelance robots, PLC and CNC programmer.

    D 2 Replies Last reply
    0
    • D dreamerzz

      Hi, For a normal Visual C++ program, we have a void main. But in creating a MFC single document interface, does anyone know which function is something similar to void main? Thanks for ur help

      L Offline
      L Offline
      Larry J Siddens
      wrote on last edited by
      #8

      Sounds like all you want to have is your app start once the linking processs has completed in the DevStudio. Correct? If so, then use the short cut Ctrl+F5 (unless it is mapped somewhere else). This compiles/links and then starts the app. Larry J. Siddens

      T 1 Reply Last reply
      0
      • J Joan M

        Argh... the internet connection failed just when I posted the first answer... :mad: well... X| lets do it again... You can do it in three ways: -> if you don't need to do anything to the GUI you can use the InitInstance function in the main class. -> if you need to interact with the main frame (the SDI document view container) you can do it in the precreatewindow function in the mainframe class. -> if you need to interact with the view you can do it in the precreatewindow of the view class. hope this helps...

        D Offline
        D Offline
        dreamerzz
        wrote on last edited by
        #9

        Hi, Thanks for ur help.. i will give it a try and will let u know abt the results.. Thanks a million dreamerzz

        1 Reply Last reply
        0
        • L Larry J Siddens

          Sounds like all you want to have is your app start once the linking processs has completed in the DevStudio. Correct? If so, then use the short cut Ctrl+F5 (unless it is mapped somewhere else). This compiles/links and then starts the app. Larry J. Siddens

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #10

          yes that's it. it also have an icon in the toolbar which look a red exclamation mark (next to the compile icon...


          TOXCCT >>> GEII power

          1 Reply Last reply
          0
          • D dreamerzz

            oh.. sorry for the unclear msg.. I want to run the program as soon as it finish compiling and linking.. whereby the program seems to be "automatically" running.. dreamerzz

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

            Start it within the IDE using Ctrl+F5. That'll compile and link (if necessary), and then run.


            "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

            1 Reply Last reply
            0
            • D dreamerzz

              Hi, For a normal Visual C++ program, we have a void main. But in creating a MFC single document interface, does anyone know which function is something similar to void main? Thanks for ur help

              N Offline
              N Offline
              Nemanja Trifunovic
              wrote on last edited by
              #12

              dreamerzz wrote: For a normal Visual C++ program, we have a void main Strictly speaking, it is int main()

              T 1 Reply Last reply
              0
              • N Nemanja Trifunovic

                dreamerzz wrote: For a normal Visual C++ program, we have a void main Strictly speaking, it is int main()

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #13

                dreamerzz wrote: For a normal Visual C++ program, we have a void main hey man, don't panic, it is not a normal Visual C++ program as he says... We are into a WinMainX()


                TOXCCT >>> GEII power

                1 Reply Last reply
                0
                • J Joan M

                  Argh... the internet connection failed just when I posted the first answer... :mad: well... X| lets do it again... You can do it in three ways: -> if you don't need to do anything to the GUI you can use the InitInstance function in the main class. -> if you need to interact with the main frame (the SDI document view container) you can do it in the precreatewindow function in the mainframe class. -> if you need to interact with the view you can do it in the precreatewindow of the view class. hope this helps...

                  D Offline
                  D Offline
                  dreamerzz
                  wrote on last edited by
                  #14

                  Hi, thanks for the help given dReaMerzZ

                  J 1 Reply Last reply
                  0
                  • D dreamerzz

                    Hi, thanks for the help given dReaMerzZ

                    J Offline
                    J Offline
                    Joan M
                    wrote on last edited by
                    #15

                    That's ok! ;) has it worked OK?

                    https://www.robotecnik.com freelance robots, PLC and CNC programmer.

                    D 1 Reply Last reply
                    0
                    • J Joan M

                      That's ok! ;) has it worked OK?

                      D Offline
                      D Offline
                      dreamerzz
                      wrote on last edited by
                      #16

                      Instead of using the void main, I have integrate my 2 MFC to become one.. so it works perfectly fine.. ;)

                      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