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. WaitForInputIdle parent process gets access exception

WaitForInputIdle parent process gets access exception

Scheduled Pinned Locked Moved C / C++ / MFC
business
6 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi I am waiting for a child process to complete initialization so that I can get its window handle After I do CreateProcess I use the PROCESS_INFORMATION pi parameter of The CreateProcess to WaitForInputIdle(pi.hProcess,INFINITE); The Child process goes about its business intitializing in InitInstance returns TRUE It has a message map After the return TRUE from InitInstance, the parent breaks from WaitForInputIdle with a Access Exception Thanks

    L 1 Reply Last reply
    0
    • F ForNow

      Hi I am waiting for a child process to complete initialization so that I can get its window handle After I do CreateProcess I use the PROCESS_INFORMATION pi parameter of The CreateProcess to WaitForInputIdle(pi.hProcess,INFINITE); The Child process goes about its business intitializing in InitInstance returns TRUE It has a message map After the return TRUE from InitInstance, the parent breaks from WaitForInputIdle with a Access Exception Thanks

      L Offline
      L Offline
      leon de boer
      wrote on last edited by
      #2

      What you have detailed is correct and the recommended way to do it So you therefore have a coding error which can be (i) The launched process does not have a graphical interface ... must not be a console app which has no queue (ii) The createprocess startup structure is invalid If the launched process is yours you can go around the whole problem by using an Interprocess communication method. If the launched process isn't yours check your code with notepad or something simple which that technique works with.

      In vino veritas

      F 1 Reply Last reply
      0
      • L leon de boer

        What you have detailed is correct and the recommended way to do it So you therefore have a coding error which can be (i) The launched process does not have a graphical interface ... must not be a console app which has no queue (ii) The createprocess startup structure is invalid If the launched process is yours you can go around the whole problem by using an Interprocess communication method. If the launched process isn't yours check your code with notepad or something simple which that technique works with.

        In vino veritas

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        Thanks so much I see all of the info of the startup structure can be ignored can I memset The entire structure to NULLs

        L 1 Reply Last reply
        0
        • F ForNow

          Thanks so much I see all of the info of the startup structure can be ignored can I memset The entire structure to NULLs

          L Offline
          L Offline
          leon de boer
          wrote on last edited by
          #4

          The .cb field is the only mandatory field which must be set to sizeof(STARTUPINFO); You can memset it and then set the .cb field but it's just as easy to zero the variable creation

          STARTUPINFO startupInfo = {0};
          startupInfo.cb = sizeof(startupInfo);

          your suggestion is fine as well

          STARTUPINFO startupInfo;
          memset(startupinfo, 0, sizeof(startupinfo));
          startupInfo.cb = sizeof(startupInfo);

          In vino veritas

          F 1 Reply Last reply
          0
          • L leon de boer

            The .cb field is the only mandatory field which must be set to sizeof(STARTUPINFO); You can memset it and then set the .cb field but it's just as easy to zero the variable creation

            STARTUPINFO startupInfo = {0};
            startupInfo.cb = sizeof(startupInfo);

            your suggestion is fine as well

            STARTUPINFO startupInfo;
            memset(startupinfo, 0, sizeof(startupinfo));
            startupInfo.cb = sizeof(startupInfo);

            In vino veritas

            F Offline
            F Offline
            ForNow
            wrote on last edited by
            #5

            Checking my code seems I have already done that Thanks

            F 1 Reply Last reply
            0
            • F ForNow

              Checking my code seems I have already done that Thanks

              F Offline
              F Offline
              ForNow
              wrote on last edited by
              #6

              thanks

              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