| 1119 | SetFocus(wnd); |
| 1120 | |
| 1121 | return true; |
| 1122 | } |
| 1123 | }; |
| 1124 | struct QiFunc_wnd_close : public QiFunc |
| 1125 | { |
| 1126 | QiFunc_wnd_close() : QiFunc(1) {} |
| 1127 | QiVar exec(const std::vector<QiVar>& args, QiScriptInterpreter*) const override |
| 1128 | { |
| 1129 | auto wnd = reinterpret_cast<HWND>(args[0].toPointer()); |
| 1130 | if (!IsWindow(wnd)) return false; |
| 1131 | static_cast<bool>(CloseWindow(wnd)); |
| 1132 | if (!IsWindow(wnd)) return true; |
| 1133 | PostMessageW(wnd, WM_CLOSE, 0, 0); |
| 1134 | if (!IsWindow(wnd)) return true; |
| 1135 | PostMessageW(wnd, WM_DESTROY, 0, 0); |
| 1136 | if (!IsWindow(wnd)) return true; |
| 1137 | PostMessageW(wnd, WM_QUIT, 0, 0); |