def shell__pump_messages(on_exit_callback=None):
assert on_exit_callback is None or callable(on_exit_callback)
message = wintypes.MSG()
while True:
msg = GetMessageW(byref(message), 0, 0, 0)
if msg <= 0:
# print("DEBUG quit message in queue")
# 0 means WM_QUIT, < 0 means error
if on_exit_callback is not None and callable(on_exit_callback):
on_exit_callback()
else:
sys.exit(0)
else:
TranslateMessage(byref(message))
DispatchMessageW(byref(message))
# see https://msdn.microsoft.com/en-us/library/windows/desktop/ms644967(v=vs.85).aspx
评论列表
文章目录