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

Createprocess()

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
7 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.
  • P Offline
    P Offline
    punav
    wrote on last edited by
    #1

    I am trying to open a exe file through my application. I am using CreateProcess() for the same But before the application lauches the next line starts executing. I added Sleep(10000). But that does not help everytime Please suggest how can I wait till application is up and then proceed with other calls.

    J C E 3 Replies Last reply
    0
    • P punav

      I am trying to open a exe file through my application. I am using CreateProcess() for the same But before the application lauches the next line starts executing. I added Sleep(10000). But that does not help everytime Please suggest how can I wait till application is up and then proceed with other calls.

      J Offline
      J Offline
      Joseph Marzbani
      wrote on last edited by
      #2

      What does the next line do? What kind of problem does the next line make to be execute? tell a little more about your problem...

      P 1 Reply Last reply
      0
      • P punav

        I am trying to open a exe file through my application. I am using CreateProcess() for the same But before the application lauches the next line starts executing. I added Sleep(10000). But that does not help everytime Please suggest how can I wait till application is up and then proceed with other calls.

        C Offline
        C Offline
        Chandrasekharan P
        wrote on last edited by
        #3

        Is'nt ShellExeute helping you?

        1 Reply Last reply
        0
        • J Joseph Marzbani

          What does the next line do? What kind of problem does the next line make to be execute? tell a little more about your problem...

          P Offline
          P Offline
          punav
          wrote on last edited by
          #4

          Here when I open a application which is a server, the mounted file systesm should create a corresponding directory.So next line is to Check for the folder in fs. This command executes imeediately and returns no folder.

          1 Reply Last reply
          0
          • P punav

            I am trying to open a exe file through my application. I am using CreateProcess() for the same But before the application lauches the next line starts executing. I added Sleep(10000). But that does not help everytime Please suggest how can I wait till application is up and then proceed with other calls.

            E Offline
            E Offline
            Eytukan
            wrote on last edited by
            #5

            WaitForInputIdle or GetExitCodeProcess may help?

            He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

            P 1 Reply Last reply
            0
            • E Eytukan

              WaitForInputIdle or GetExitCodeProcess may help?

              He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

              P Offline
              P Offline
              punav
              wrote on last edited by
              #6

              I am using below function and its working fine for now. DWORD dwExit = WaitForSingleObject(piProcessInfo.hProcess,5 * 10000); This is incorporating required delay.

              E 1 Reply Last reply
              0
              • P punav

                I am using below function and its working fine for now. DWORD dwExit = WaitForSingleObject(piProcessInfo.hProcess,5 * 10000); This is incorporating required delay.

                E Offline
                E Offline
                Eytukan
                wrote on last edited by
                #7

                I think that's the only way. (up to my knowledge) because GetExitCodes just get the termination status. May be after waiting , you can check for STILL_ACTIVE status. But your design sounds little bad. What is that you are trying to do? May be you could synchronize your processes with kernel objects like Events. That would be a better solution.

                He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

                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