title: MFC modeless and modal dialog
body: <p>I have an application with tray icon. There is a hidden main window (CMainFrm), which is used to process tray icon messages. The tray icon has a context menu: Settings, Help, Exit commands.</p>
  
  <p>When user chooses Settings, the modeless settings dialog is displayed (parent: GetDesktopWindow()).
  Settings dialog has a browse button which displays MyBrowseFolderDialog as modal! So, there is a problem when this dialog is displayed and user tries to close application using Exit command from the tray menu.</p>
  
  <p>Does anyone know how to gracefully close the application with all these dialogs?
  tray menu => Settings dialog (modeless) => BrowseDialog (modal)</p>