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. Suspend Program Execution

Suspend Program Execution

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
3 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.
  • D Offline
    D Offline
    Daniel1324
    wrote on last edited by
    #1

    I have an SDI app that uses an ini file to store settings. The user has the option to manually edit the ini file from my program, which is done through notepad. What I want to do is suspend execution of my program until notepad exits. I read up on createprocess() and shellexecute() along with waitforsingleobject()but couldnt figure out how to do it. Any help would be great! Thanks, Daniel

    W 1 Reply Last reply
    0
    • D Daniel1324

      I have an SDI app that uses an ini file to store settings. The user has the option to manually edit the ini file from my program, which is done through notepad. What I want to do is suspend execution of my program until notepad exits. I read up on createprocess() and shellexecute() along with waitforsingleobject()but couldnt figure out how to do it. Any help would be great! Thanks, Daniel

      W Offline
      W Offline
      wb
      wrote on last edited by
      #2

      here is some code I use to open an UDL file and wait for the UDL Editor to exit. BUT! Your main thread is blocked and so the repaint is blocked!!! SHELLEXECUTEINFO inf; memset(&inf,0,sizeof(SHELLEXECUTEINFO)); inf.cbSize = sizeof(SHELLEXECUTEINFO); inf.fMask=SEE_MASK_NOCLOSEPROCESS; inf.lpVerb=_T("open"); inf.lpFile=sUdlFile; if(ShellExecuteEx(&inf)) { WaitForSingleObject(inf.hProcess,-1); CloseHandle(inf.hProcess); }

      D 1 Reply Last reply
      0
      • W wb

        here is some code I use to open an UDL file and wait for the UDL Editor to exit. BUT! Your main thread is blocked and so the repaint is blocked!!! SHELLEXECUTEINFO inf; memset(&inf,0,sizeof(SHELLEXECUTEINFO)); inf.cbSize = sizeof(SHELLEXECUTEINFO); inf.fMask=SEE_MASK_NOCLOSEPROCESS; inf.lpVerb=_T("open"); inf.lpFile=sUdlFile; if(ShellExecuteEx(&inf)) { WaitForSingleObject(inf.hProcess,-1); CloseHandle(inf.hProcess); }

        D Offline
        D Offline
        Daniel1324
        wrote on last edited by
        #3

        Thanks! Works great!

        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