title: How to get the Executable name of a window
body: <p>I try to get the name of executable name of all of my launched windows and my problem is that:</p>
  
  <p>I use the method</p>
  
  <pre><code>UINT GetWindowModuleFileName(      
  HWND hwnd,
  LPTSTR lpszFileName,
  UINT cchFileNameMax);
  </code></pre>
  
  <p>And I don't understand why it doesn't work.</p>
  
  <p>Data which I have about a window are: <br />-HWND AND PROCESSID</p>
  
  <p>The error is:
  e.g:</p>
  
  <pre><code>HWND: 00170628 
  ProcessId: 2336        
  WindowTitle: C:\test.cpp - Notepad++
  GetWindowModuleFileName():  C:\test.exe
  
  HWND: 00172138 
  ProcessId: 2543        
  WindowTitle: Firefox
  GetWindowModuleFileName():  C:\test.exe
  
  HWND: 00120358 
  ProcessId: 2436        
  WindowTitle: Mozilla Thunderbird
  GetWindowModuleFileName():  C:\test.exe
  </code></pre>
  
  <p>Note: test.exe is the name of my executable file, but it is not the fullpath of Notepad++... and it make this for Mozilla Thunderbird too... I don't understand why</p>
  
  <p>I use the function like this:</p>
  
  <pre><code>char filenameBuffer[4000];
  if (GetWindowModuleFileName(hWnd, filenameBuffer, 4000) &gt; 0)
  {
      std::cout &lt;&lt; "GetWindowModuleFileName(): " &lt;&lt; filenameBuffer &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>Thank you for your response.</p>