title: c++ How to close PDF file using TerminateProcess and handle of child process
body: <p>I want to close a pdf file from my c++ application.
  I use ShellExecuteEx to open pdf file, and I catch the handle of the process.</p>
  
  <pre><code>std::string s = "myfile.pdf";
  std::wstring stemp = std::wstring(s.begin(), s.end());
  LPCWSTR sw = stemp.c_str();
  SHELLEXECUTEINFO ShExecInfo;
  ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
  ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
  ShExecInfo.hwnd = NULL;
  ShExecInfo.lpVerb = NULL;
  ShExecInfo.lpFile = sw;
  ShExecInfo.lpParameters = NULL;
  ShExecInfo.lpDirectory = NULL;
  ShExecInfo.nShow = SW_MAXIMIZE;
  ShExecInfo.hInstApp = NULL;
  
  ShellExecuteEx(&amp;ShExecInfo);
  HANDLE handle = ShExecInfo.hProcess ;
  </code></pre>
  
  <p>//I can now close pdf file 
     TerminateProcess (handle, 0);</p>
  
  <p>My problem is, if acrobat is launched by another process, before my application is launched, TerminateProcess (handle, 0) doesn't do anything.
  So how I can get parent handle ?
  Thank you</p>