归还窗口
(self)
| 85 | win32gui.SetParent(hwnd, int(self.winId())) |
| 86 | |
| 87 | def restore(self): |
| 88 | """归还窗口""" |
| 89 | # 有bug,归还后窗口没有了WS_VISIBLE样式,不可见 |
| 90 | widget = self.layout().itemAt(4).widget() |
| 91 | hwnd, phwnd, style, exstyle, wrect = widget.hwnd, widget.phwnd, widget.style, widget.exstyle, widget.wrect |
| 92 | print('restore', hwnd, phwnd, style, exstyle, wrect) |
| 93 | widget.close() |
| 94 | self.layout().removeWidget(widget) # 从布局中移出 |
| 95 | widget.deleteLater() |
| 96 | |
| 97 | win32gui.SetParent(hwnd, phwnd) # 让它返回它的父窗口 |
| 98 | win32gui.SetWindowLong(hwnd, win32con.GWL_STYLE, style | win32con.WS_VISIBLE) # 恢复样式 |
| 99 | win32gui.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, exstyle) # 恢复样式 |
| 100 | win32gui.ShowWindow(hwnd, win32con.SW_SHOW) # 显示窗口 |
| 101 | win32gui.SetWindowPos(hwnd, 0, wrect[0], wrect[1], wrect[2], wrect[3], win32con.SWP_NOACTIVATE) |
| 102 | |
| 103 | def _enumWindows(self, hwnd, _): |
| 104 | """遍历回调函数""" |
no test coverage detected