title: Closing a process child window (e.g. a Word window) accessing a specific file
body: <p>Scenario (for force deleting a file, can't go for delete on restart):</p>
  
  <ol>
  <li>I have a file that is opened in some program, say M.S. Word. There could be some other files as well opened in M.S. Word.</li>
  <li>In my C# program, I need to know what process is accessing that particular file and need to close/release only that particular file from Word. Other files should not be disturbed, so I won't use Process.Kill() method.</li>
  </ol>
  
  <p>Given the above scenario, I have done the following:</p>
  
  <ol>
  <li><p>Found the process (instance of Process class) accessing my target file using the code <a href="http://msdn.microsoft.com/en-us/magazine/cc163450.aspx" rel="nofollow noreferrer">here</a></p></li>
  <li><p>Found a list of handles held by that process (using NtQuerySystemInformation() method).</p></li>
  <li>From the list of handles, I was able to find the particular handle holding my file (using NtQueryObject() method). Tried to call CloseHandle() on this handle but that does not work.</li>
  <li>Now I can also list down all child window handles from my target process.</li>
  </ol>
  
  <p>How do I find that particular window handle that is related to the file handle I found in step 3 above? My plan is to use SendMessage() method with WM_CLOSE message to that particular window so it would be closed and my file would be released.</p>
  
  <p>One way is to check the file name string in that child window's title and then close that window. But the issue is, a file with the same name could have been opened from some different location.</p>