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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  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.
  • J jmkhael

    The main in MFC is a "WinMainX" and is somehow "invisible" to the eye, it was wrapped by MFC code, What do you exactly need? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

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

    Hi, I would like the program to start running once i compile the program.. so i was thinking if i could add my coding in the void main then i can get it start running the minute i compile it.. dreamerzz

    J 1 Reply Last reply
    0
    • D dreamerzz

      Hi, I would like the program to start running once i compile the program.. so i was thinking if i could add my coding in the void main then i can get it start running the minute i compile it.. dreamerzz

      J Offline
      J Offline
      jmkhael
      wrote on last edited by
      #4

      you mean while compiling it???? or you want a program to run while compiling another? o you want to run the program as soon as it finish compiling and linking? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

      D 1 Reply Last reply
      0
      • J jmkhael

        The main in MFC is a "WinMainX" and is somehow "invisible" to the eye, it was wrapped by MFC code, What do you exactly need? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

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

        See AppModul.cpp for specific implementation details of _tWinMain.  onwards and upwards...

        1 Reply Last reply
        0
        • J jmkhael

          you mean while compiling it???? or you want a program to run while compiling another? o you want to run the program as soon as it finish compiling and linking? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

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

          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 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

            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