title: Capture the "Save your changes" dialog when using win32gui and closing an embedded application within a QApplication?
body: <p>I am embedding an application within a tab in a pyqt QApplication. When I close the tab this application is embedded in how do I allow it to display the "Save your changes" dialog?</p>
  
  <p>I use this on tab_close:</p>
  
  <pre><code>win32gui.PostMessage(int(wdg.process._handle),win32con.WM_CLOSE,0,0)
  </code></pre>
  
  <p>When I do this though, I lose this dialog box, if the application would normally throw one up.</p>
  
  <p><a href="https://i.stack.imgur.com/xIfBY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xIfBY.png" alt="Missing Prompt"></a></p>
  
  <p>The code looks similar to this:</p>
  
  <pre><code>class MainWindow(QTabWidget):
      def __init__(self, parent=None):
          QTabWidget.__init__(self, parent)
          self.setTabsClosable(1)
          self.tabCloseRequested.connect(self.close_tab)
  
      ...
  
      def close_tab(self,ind):
          wdg = self.widget(ind)
          win32gui.PostMessage(int(wdg.process._handle),win32con.WM_CLOSE,0,0)
          self.removeTab(ind)
          del wdg
  
      ...
  </code></pre>
  
  <p>This produces a UI like this (with Window's notepad.exe embedded). Clicking the "X" on the tab will close Notepad without prompting the user to save any input.</p>
  
  <p><a href="https://i.stack.imgur.com/ofgpL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ofgpL.png" alt="Embedded Notepad in a tab"></a></p>
  
  <p>How can I close the tab and allow the embedded application to prompt a user to save their changes?</p>