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. WinExec return value, Createprocess return value? VC++ 6.0

WinExec return value, Createprocess return value? VC++ 6.0

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
3 Posts 3 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
    rolfhorror
    wrote on last edited by
    #1

    I have a dialog app with a function similar to this: void CMyDlg::OnButton1() { //This bit works WinExec("cmd.exe /c xcopy /s "+myfolder+" "+target_folder+" >>mylog.txt&exit",SW_HIDE); // This is what i want to do: // if (all files have been copied and cmd.exe exits then display the msgbox, if not, wait until filecopy is done and then display the msgbox) // { AfxMessageBox("Done! All files copied to target folder.",MB_OK|MB_ICONINFORMATION); // } } The way the function works right now, the msgbox displays too early, and not after all the files are copied. I guess i need some kind of return value, and then if its true/false then display msgbox. How to solve this problem, any suggestions? Is this "doable" in any easy way? Createprocess? If so, how would the Createprocess code look like? thx!

    R D 2 Replies Last reply
    0
    • R rolfhorror

      I have a dialog app with a function similar to this: void CMyDlg::OnButton1() { //This bit works WinExec("cmd.exe /c xcopy /s "+myfolder+" "+target_folder+" >>mylog.txt&exit",SW_HIDE); // This is what i want to do: // if (all files have been copied and cmd.exe exits then display the msgbox, if not, wait until filecopy is done and then display the msgbox) // { AfxMessageBox("Done! All files copied to target folder.",MB_OK|MB_ICONINFORMATION); // } } The way the function works right now, the msgbox displays too early, and not after all the files are copied. I guess i need some kind of return value, and then if its true/false then display msgbox. How to solve this problem, any suggestions? Is this "doable" in any easy way? Createprocess? If so, how would the Createprocess code look like? thx!

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      Google for "CProcessWait". It used to be in an article here on CP, but PJ Naughter or Arendt (sorry do not know anymore) put it in a utility library.

      Don't follow any man spiritually, don't do anything that will get you in sh*t if god is real - Bradml[^]

      1 Reply Last reply
      0
      • R rolfhorror

        I have a dialog app with a function similar to this: void CMyDlg::OnButton1() { //This bit works WinExec("cmd.exe /c xcopy /s "+myfolder+" "+target_folder+" >>mylog.txt&exit",SW_HIDE); // This is what i want to do: // if (all files have been copied and cmd.exe exits then display the msgbox, if not, wait until filecopy is done and then display the msgbox) // { AfxMessageBox("Done! All files copied to target folder.",MB_OK|MB_ICONINFORMATION); // } } The way the function works right now, the msgbox displays too early, and not after all the files are copied. I guess i need some kind of return value, and then if its true/false then display msgbox. How to solve this problem, any suggestions? Is this "doable" in any easy way? Createprocess? If so, how would the Createprocess code look like? thx!

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

        rolfhorror wrote:

        Createprocess? If so, how would the Createprocess code look like?

        Call CreateProcessEx() followed by WaitForSingleObject().


        "A good athlete is the result of a good and worthy opponent." - David Crow

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        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