def ExitInstance(self): " Called as the app dies - too late to prevent it here! " win32ui.OutputDebug("Application shutdown\n") # Restore the callback manager, if any. try: win32ui.InstallCallbackCaller(self.oldCallbackCaller) except AttributeError: pass if self.oldCallbackCaller: del self.oldCallbackCaller self.frame = None # clean Python references to the now destroyed window object. self.idleHandlers = [] # Attempt cleanup if not already done! if self._obj_: self._obj_.AttachObject(None) self._obj_ = None global App global AppBuilder App = None AppBuilder = None return 0
def ExitInstance(self): if self.frame and hasattr(self.frame,'DestroyWindow'): self.frame.DestroyWindow() self.frame = None if hasattr(self,'SetMainFrame'): self.SetMainFrame(None) import __main__ if hasattr(__main__,'resdll'): del __main__.resdll win32ui.OutputDebug("Application shutdown\n") # Restore the callback manager, if any. try: win32ui.InstallCallbackCaller(self.oldCallbackCaller) except AttributeError: pass if self.oldCallbackCaller: del self.oldCallbackCaller self.idleHandlers = [] # Attempt cleanup if not already done! if self._obj_: self._obj_.AttachObject(None) self._obj_ = None return 0
rc = 0 # use afx to unload com/ole lib #(win32ui.GetAfx()).PostQuitMessage(rc) win32ui.GetMainFrame().PostMessage(WM_CLOSE) except: # We trap all other errors, ensure the main window is shown, then # print the traceback. try: win32ui.GetMainFrame().ShowWindow(SW_SHOW) except win32ui.error: print "Cant show the main frame!" traceback.print_exc() return win32ui.InstallCallbackCaller(SafeCallbackCaller) def Boot(what=0): # Locate the GRiNSRes.dll file. This is presumably in the same directory as # the extensionmodules, or if frozen, in the main directory # This call allows Pythonwin to automatically find resources in it. import win32ui dllPath = os.path.split(win32ui.__file__)[0] try: global resdll resdll = win32ui.LoadLibrary(os.path.join(dllPath, "GRiNSRes.dll")) resdll.AttachToMFC() except win32ui.error: win32ui.MessageBox( "The application resource DLL 'GRiNSRes.dll' can not be located\r\n\r\nPlease correct this problem, and restart the application"