def MyWndProc(self, hWnd, msg, wParam, lParam): if msg == win32con.WM_CHANGECBCHAIN: self.OnChangeCBChain(msg, wParam, lParam) elif msg == win32con.WM_DRAWCLIPBOARD: self.OnDrawClipboard(msg, wParam, lParam) if msg == win32con.WM_DESTROY: if self.nextWnd: win32clipboard.ChangeClipboardChain(self.hwnd, self.nextWnd) else: win32clipboard.ChangeClipboardChain(self.hwnd, 0) win32api.SetWindowLong(self.hwnd, win32con.GWL_WNDPROC, self.oldWndProc) # 分析并保存结果 self.save_proxies() self.clipboard.Close() return win32gui.CallWindowProc(self.oldWndProc, hWnd, msg, wParam, lParam)
def MyWndProc(self, hWnd, msg, wParam, lParam): if msg == win32con.WM_CHANGECBCHAIN: self.OnChangeCBChain(msg, wParam, lParam) elif msg == win32con.WM_DRAWCLIPBOARD: self.OnDrawClipboard(msg, wParam, lParam) # Restore the old WndProc. Notice the use of win32api # instead of win32gui here. This is to avoid an error due to # not passing a callable object. if msg == win32con.WM_DESTROY: if self.nextWnd: win32clipboard.ChangeClipboardChain(self.hwnd, self.nextWnd) else: win32clipboard.ChangeClipboardChain(self.hwnd, 0) win32api.SetWindowLong(self.hwnd, win32con.GWL_WNDPROC, self.oldWndProc) # Pass all messages (in this case, yours may be different) on # to the original WndProc return win32gui.CallWindowProc(self.oldWndProc, hWnd, msg, wParam, lParam)
def stop( self ): self.running = False # timing data pickle.dump( self.timeData, open( 'media/misc/timing.%s.dat' % self.fileId, 'wb' ), -1 ) self.timingFile.close() # wave file being written self.waveFile.close() # remove clipboard hooks win32clipboard.ChangeClipboardChain( self.window.GetSafeHwnd(), self.hPrev ) self.window.DestroyWindow() # async audio input stream try: while self.stream.is_active(): self.stream.stop_stream() self.stream.close() except IOError, e: print 'Failed to close audio stream properly:', e
def StopListen(self): if self.hPrev: win32clipboard.ChangeClipboardChain(self.win.GetSafeHwnd(), self.hPrev) else: win32clipboard.ChangeClipboardChain(self.win.GetSafeHwnd(), 0)
def OnClose(self, hwnd, msg, wp, lp): win32clipboard.ChangeClipboardChain(hwnd, self.hwndNextViewer) win32gui.DestroyWindow(hwnd) win32gui.PostQuitMessage(0)