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. Createprocess in vc++

Createprocess in vc++

Scheduled Pinned Locked Moved C / C++ / MFC
c++
6 Posts 5 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.
  • R Offline
    R Offline
    raj1576
    wrote on last edited by
    #1

    hi all I am using copy command in createprocess() but this is not working I am writing following code but this is not working AnsiString cmdpath = "copy /b c:\\000.mp3+c:\\001.mp3 c:\\out.mp3"; PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_FORCEMINIMIZE ; ShowMessage(cmdpath); CreateProcessA(NULL, cmdpath.c_str(), NULL, NULL, FALSE,NULL, NULL, NULL, &sInfo, &pInfo); if(WaitForSingleObject(pInfo.hProcess,INFINITE)== WAIT_OBJECT_0) { ShowMessage("Success"); }

    K E G 3 Replies Last reply
    0
    • R raj1576

      hi all I am using copy command in createprocess() but this is not working I am writing following code but this is not working AnsiString cmdpath = "copy /b c:\\000.mp3+c:\\001.mp3 c:\\out.mp3"; PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_FORCEMINIMIZE ; ShowMessage(cmdpath); CreateProcessA(NULL, cmdpath.c_str(), NULL, NULL, FALSE,NULL, NULL, NULL, &sInfo, &pInfo); if(WaitForSingleObject(pInfo.hProcess,INFINITE)== WAIT_OBJECT_0) { ShowMessage("Success"); }

      K Offline
      K Offline
      KingsGambit
      wrote on last edited by
      #2

      CreateProcess requires an executable file's path. You may have to use cmd.exe and pass "copy" as the commandline argument.

      1 Reply Last reply
      0
      • R raj1576

        hi all I am using copy command in createprocess() but this is not working I am writing following code but this is not working AnsiString cmdpath = "copy /b c:\\000.mp3+c:\\001.mp3 c:\\out.mp3"; PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_FORCEMINIMIZE ; ShowMessage(cmdpath); CreateProcessA(NULL, cmdpath.c_str(), NULL, NULL, FALSE,NULL, NULL, NULL, &sInfo, &pInfo); if(WaitForSingleObject(pInfo.hProcess,INFINITE)== WAIT_OBJECT_0) { ShowMessage("Success"); }

        E Offline
        E Offline
        Eugen Podsypalnikov
        wrote on last edited by
        #3

        The process name could be "cmd" and its parameter - "/c copy ..." :)

        R 1 Reply Last reply
        0
        • E Eugen Podsypalnikov

          The process name could be "cmd" and its parameter - "/c copy ..." :)

          R Offline
          R Offline
          raj1576
          wrote on last edited by
          #4

          Thanks Eugen for reply now its working

          R 1 Reply Last reply
          0
          • R raj1576

            Thanks Eugen for reply now its working

            R Offline
            R Offline
            Rozis
            wrote on last edited by
            #5

            But why don't you just copy the file from within the program? Now you'll run a Cmd to do the copy. Bet your language can copy the file with just 1 line of code....

            1 Reply Last reply
            0
            • R raj1576

              hi all I am using copy command in createprocess() but this is not working I am writing following code but this is not working AnsiString cmdpath = "copy /b c:\\000.mp3+c:\\001.mp3 c:\\out.mp3"; PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_FORCEMINIMIZE ; ShowMessage(cmdpath); CreateProcessA(NULL, cmdpath.c_str(), NULL, NULL, FALSE,NULL, NULL, NULL, &sInfo, &pInfo); if(WaitForSingleObject(pInfo.hProcess,INFINITE)== WAIT_OBJECT_0) { ShowMessage("Success"); }

              G Offline
              G Offline
              Gary R Wheeler
              wrote on last edited by
              #6

              Use the CopyFile[^] Win32 API function instead.

              Software Zen: delete this;
              Fold With Us![^]

              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