def do_close_session():
hwnd = QQ_checkTargetWindow()
if hwnd == 0:
print "Window doesn't exist, no need to close session."
return
else:
print "move the window to front."
win32gui.SetForegroundWindow(hwnd)
time.sleep(1.0)
for try_time in range(0, 10, 1):
print "try to close the current session, try_time = " + str(try_time)
QQ_CloseWindow()
time.sleep(1.0)
if QQ_checkTargetWindow() != 0:
QQ_CloseWindow()
print "close fails, probably the file is still in transmission."
time.sleep(5.0)
else:
print "session closed."
return
print "can't close the current session, abort."
评论列表
文章目录