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. MFC CreteProcess

MFC CreteProcess

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++visual-studioquestion
5 Posts 4 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 Offline
    C Offline
    charu123
    wrote on last edited by
    #1

    hi, I am using the create process function to open an application. but i guess my usage is not right. could somebody tell me what is wrong. the function i ahve used is........... CreateProcess("C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\msdev.exe",NULL,NULL,NULL,TRUE,DEBUG_PROCESS ,NULL,NULL,NULL,NULL) Thanks:) U get wht u Give

    T T 2 Replies Last reply
    0
    • C charu123

      hi, I am using the create process function to open an application. but i guess my usage is not right. could somebody tell me what is wrong. the function i ahve used is........... CreateProcess("C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\msdev.exe",NULL,NULL,NULL,TRUE,DEBUG_PROCESS ,NULL,NULL,NULL,NULL) Thanks:) U get wht u Give

      T Offline
      T Offline
      Tareq Ahmed Siraj
      wrote on last edited by
      #2

      Shouldnt this be something like....

      CreateProcess("C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe",NULL,NULL,NULL,TRUE,DEBUG_PROCESS
      ,NULL,NULL,NULL,NULL)
      

      Hope this helps. - tareq

      C 1 Reply Last reply
      0
      • T Tareq Ahmed Siraj

        Shouldnt this be something like....

        CreateProcess("C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe",NULL,NULL,NULL,TRUE,DEBUG_PROCESS
        ,NULL,NULL,NULL,NULL)
        

        Hope this helps. - tareq

        C Offline
        C Offline
        charu123
        wrote on last edited by
        #3

        its not working:-( U get wht u Give

        D 1 Reply Last reply
        0
        • C charu123

          hi, I am using the create process function to open an application. but i guess my usage is not right. could somebody tell me what is wrong. the function i ahve used is........... CreateProcess("C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\msdev.exe",NULL,NULL,NULL,TRUE,DEBUG_PROCESS ,NULL,NULL,NULL,NULL) Thanks:) U get wht u Give

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          charu123 wrote: CreateProcess("C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\msdev.exe",NULL,NULL,NULL,TRUE,DEBUG_PROCESS,NULL,NULL,NULL,NULL) Do u want to attach DEBUGGER with the launched Process, if yes you also have to use WaitForDebugEvent function with it. if NO, here is small piece of code:-

          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). 
              "c:\\\\windows\\\\notepad.exe", // 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.
          ) 
          {
              MessageBox( "CreateProcess failed." );
          }
          

          Don't ask me from where i get this code :->


          [Vote One Here, Complete my Survey....] Alok Gupta
          visit me at http://www.thisisalok.tk          "I Think Believe this Will Help"

          1 Reply Last reply
          0
          • C charu123

            its not working:-( U get wht u Give

            D Offline
            D Offline
            DasdaDAS
            wrote on last edited by
            #5

            You need to mention the two parameters(STARTUPINFO & PROCESS_INFORMATION) and initialize it. Then the path of the the ".exe" file should be specified with "\\" instead of "\". If u use "\" the compiler will understand that as a escape sequence. STARTUPINFO sinfo; PROCESS_INFORMATION pinfo; ZeroMemory( &sinfo, sizeof(sinfo) ); sinfo.cb = sizeof(sinfo); ZeroMemory( &pinfo, sizeof(pinfo) ); BOOL b = CreateProcess("C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe",NULL,NULL,NULL,NULL,NULL,NULL,NULL,&sinfo,&pinfo); int error = GetLastError(); try this and let me know, if u have any problem.:cool: Zxczc

            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