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 questions

createProcess questions

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

    1. The foll code is what I will use.

    STARTUPINFO si = { sizeof(STARTUPINFO) };	PROCESS\_INFORMATION pi;		// Create the process	if (!::CreateProcess(NULL, "your.exe", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))	{		AfxMessageBox("Error starting the process!");		return;	} 	// Wait till it ends	::WaitForSingleObject(pi.hProcess, INFINITE); 	// Clean up	::CloseHandle(pi.hProcess);	::CloseHandle(pi.hThread);
    

    Q1. If the exe launched is a windows app that needs some stuff done by the user, and then it is exited, will the WaitForSIngleObject will come back only after this launched windows app terminates? Q2. If the launched process awaits the user, but he decides to press some other button on the main program (not the launched program) will the button respond? Or will the main app be unresponsive until the user has dealt with the launched app and exited it? Appreciate your help, ns

    M 1 Reply Last reply
    0
    • N ns

      1. The foll code is what I will use.

      STARTUPINFO si = { sizeof(STARTUPINFO) };	PROCESS\_INFORMATION pi;		// Create the process	if (!::CreateProcess(NULL, "your.exe", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))	{		AfxMessageBox("Error starting the process!");		return;	} 	// Wait till it ends	::WaitForSingleObject(pi.hProcess, INFINITE); 	// Clean up	::CloseHandle(pi.hProcess);	::CloseHandle(pi.hThread);
      

      Q1. If the exe launched is a windows app that needs some stuff done by the user, and then it is exited, will the WaitForSIngleObject will come back only after this launched windows app terminates? Q2. If the launched process awaits the user, but he decides to press some other button on the main program (not the launched program) will the button respond? Or will the main app be unresponsive until the user has dealt with the launched app and exited it? Appreciate your help, ns

      M Offline
      M Offline
      Magnus Westin
      wrote on last edited by
      #2

      Q1: Yes Q2: Depends. If your code is called from the application thread (the one with the message loop), then yes it will block your app until the launched app exits. But if you call it from an other thread then your app will not block. Magnus

      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