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. execution!

execution!

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
12 Posts 2 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.
  • D David Crow

    Are you wanting to do so from within the IDE?


    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

    Im using DOS, but now im used to execute it in the application oam

    D 1 Reply Last reply
    0
    • M mpapeo

      Im using DOS, but now im used to execute it in the application oam

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

      From a command prompt (not DOS), type the name of your program followed by any command-line parameters that it supports.


      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      M 1 Reply Last reply
      0
      • D David Crow

        From a command prompt (not DOS), type the name of your program followed by any command-line parameters that it supports.


        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

        But then it just opens the program even though i supplied parameters oam

        D 1 Reply Last reply
        0
        • M mpapeo

          But then it just opens the program even though i supplied parameters oam

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

          Which means you aren't doing anything with them. Look at:

          GetCommandLine()
          __argc/__argv
          CWinApp::m_lpCmdLine (MFC)


          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          M 1 Reply Last reply
          0
          • D David Crow

            Which means you aren't doing anything with them. Look at:

            GetCommandLine()
            __argc/__argv
            CWinApp::m_lpCmdLine (MFC)


            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            M Offline
            M Offline
            mpapeo
            wrote on last edited by
            #7

            I've been having network problems! Anyway i'm able to run it from Debug folder like F:\Debug>filename file1 file2 can you run this code from the command line #include #include void main( VOID ) { STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); // Start the child process. if( !CreateProcess( NULL, // No module name (use command line). TEXT("MyChildProcess"), // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. FALSE, // Set handle inheritance to FALSE. 0, // No creation flags. NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. &pi ) // Pointer to PROCESS_INFORMATION structure. ) { printf( "CreateProcess failed (%d).\n", GetLastError() ); return; } // Wait until child process exits. WaitForSingleObject( pi.hProcess, INFINITE ); // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); }

            D 1 Reply Last reply
            0
            • M mpapeo

              I've been having network problems! Anyway i'm able to run it from Debug folder like F:\Debug>filename file1 file2 can you run this code from the command line #include #include void main( VOID ) { STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); // Start the child process. if( !CreateProcess( NULL, // No module name (use command line). TEXT("MyChildProcess"), // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. FALSE, // Set handle inheritance to FALSE. 0, // No creation flags. NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. &pi ) // Pointer to PROCESS_INFORMATION structure. ) { printf( "CreateProcess failed (%d).\n", GetLastError() ); return; } // Wait until child process exits. WaitForSingleObject( pi.hProcess, INFINITE ); // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); }

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

              mpapeo wrote: can you run this code from the command line Yes, why?


              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              M 1 Reply Last reply
              0
              • D David Crow

                mpapeo wrote: can you run this code from the command line Yes, why?


                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                M Offline
                M Offline
                mpapeo
                wrote on last edited by
                #9

                Well im having problems with the below code in the bold and italic line, because i don't want to hardcode the process which i want to create (mychildprocess). I want it to be one of the commandline arguments. [code] // Start the child process. if( !CreateProcess( NULL, // No module name (use command line). TEXT("MyChildProcess"), // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. FALSE, // Set handle inheritance to FALSE. 0, // No creation flags. NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. &pi ) // Pointer to PROCESS_INFORMATION structure. ) [/code] So what can i replace TEXT with? oam

                D 1 Reply Last reply
                0
                • M mpapeo

                  Well im having problems with the below code in the bold and italic line, because i don't want to hardcode the process which i want to create (mychildprocess). I want it to be one of the commandline arguments. [code] // Start the child process. if( !CreateProcess( NULL, // No module name (use command line). TEXT("MyChildProcess"), // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. FALSE, // Set handle inheritance to FALSE. 0, // No creation flags. NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. &pi ) // Pointer to PROCESS_INFORMATION structure. ) [/code] So what can i replace TEXT with? oam

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

                  mpapeo wrote: Well im having problems... Meaning what? mpapeo wrote: if( !CreateProcess( NULL, // No module name (use command line). TEXT("MyChildProcess"), // Command line. Per MSDN: The lpApplicationName parameter can be NULL. In that case, the module name must be the first white space-delimited token in the lpCommandLine string. You've not specified a valid module name for the lpCommandLine parameter.


                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                  M 1 Reply Last reply
                  0
                  • D David Crow

                    mpapeo wrote: Well im having problems... Meaning what? mpapeo wrote: if( !CreateProcess( NULL, // No module name (use command line). TEXT("MyChildProcess"), // Command line. Per MSDN: The lpApplicationName parameter can be NULL. In that case, the module name must be the first white space-delimited token in the lpCommandLine string. You've not specified a valid module name for the lpCommandLine parameter.


                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                    M Offline
                    M Offline
                    mpapeo
                    wrote on last edited by
                    #11

                    I dont understand that, if i specify the MyChildProcess as the commandline argument it execute correctly, but then if another process which has not been specified there it doesn't execute it but instead it still execute the hardcoded one. And what should i specify for the lpCommandLine parameter? oam

                    M 1 Reply Last reply
                    0
                    • M mpapeo

                      I dont understand that, if i specify the MyChildProcess as the commandline argument it execute correctly, but then if another process which has not been specified there it doesn't execute it but instead it still execute the hardcoded one. And what should i specify for the lpCommandLine parameter? oam

                      M Offline
                      M Offline
                      mpapeo
                      wrote on last edited by
                      #12

                      Ive solve it by putting argv[] oam

                      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