title: win32gui get the current active application name
body: <p>I am just learning python and I am relativity new to it. 
  I created the following script that will get the current active windows title and print it to the window. </p>
  
  <pre><code>import win32gui
  windowTile = ""; 
  while ( True ) :
      newWindowTile = win32gui.GetWindowText (win32gui.GetForegroundWindow());        
      if( newWindowTile != windowTile ) :
          windowTile = newWindowTile ; 
          print( windowTile ); 
  </code></pre>
  
  <p>The above code snippet works. I am now trying to get the application name for the active window (<code>Foreground Window</code>) </p>
  
  <p>My question is:</p>
  
  <ul>
  <li>How do you get the foreground active windows application name in python?</li>
  </ul>
  
  <p><strong>Edit</strong> </p>
  
  <p>For example: If a user switches from a Calculator (calc.exe) to Google Chrome (chrome.exe) I want to see what the application that they switched to is called. The problem with the title is that not all applications prefix the title with the application name. For example google chrome puts the page title as the window title. I want to know what the application that the user switched to is called. </p>
  
  <pre><code>calc.exe
  chrome.exe
  </code></pre>