在 python 上使用 ctypes 不显示多个消息框
Not showing multiple messagebox using ctypes on python
您好,我有一个使用 ctypes 显示消息框的简单代码
但我的问题是在我添加 MB_TOPMOST?
之后它没有附加或重叠消息框
def msgbox(self,msg):
MB_OK = 0x0
MB_OKCXL = 0x01
MB_YESNOCXL = 0x03
MB_YESNO = 0x04
MB_HELP = 0x4000
ICON_EXLAIM=0x30
ICON_INFO = 0x40
ICON_STOP = 0x10
MB_TOPMOST=0x40000
"""
HEX VALUE LINK
https://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm
"""
writeLogs = WriteLogs(
pathLog = app_config['path_logs'] +"\"+strftime("%Y_%m_%d")+".log",
timedate = time.strftime("%m/%d/%Y %I:%M:%S %p")
)
writeLogs.appendLogA(msg)
ctypes.windll.user32.MessageBoxA(None, msg+str(operatorMessage), "[Error]", MB_OK | ICON_STOP | MB_TOPMOST)
我尝试将 MB_TOPMOST 更改为 MB_SYSTEMMODAL 并且我想要的输出带有最上面和重叠的消息错误框。
你可以参考这个link:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505%28v=vs.85%29.aspx
还有 Whosebug 上的这个 post 给了我一个想法:
Have Win32 MessageBox appear over other programs
def msgbox(self,msg):
MB_OK = 0x0
MB_OKCXL = 0x01
MB_YESNOCXL = 0x03
MB_YESNO = 0x04
MB_HELP = 0x4000
ICON_EXLAIM=0x30
ICON_INFO = 0x40
ICON_STOP = 0x10
MB_TOPMOST=0x40000
MB_SYSTEMMODAL=0x1000
"""
HEX VALUE LINK
https://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm
"""
writeLogs = WriteLogs(
pathLog = app_config['path_logs'] +"\"+strftime("%Y_%m_%d")+".log",
timedate = time.strftime("%m/%d/%Y %I:%M:%S %p")
)
writeLogs.appendLogA(msg)
ctypes.windll.user32.MessageBoxA(None, msg+str(operatorMessage), "[Error]", MB_OK | ICON_STOP | MB_SYSTEMMODAL)
您好,我有一个使用 ctypes 显示消息框的简单代码 但我的问题是在我添加 MB_TOPMOST?
之后它没有附加或重叠消息框def msgbox(self,msg):
MB_OK = 0x0
MB_OKCXL = 0x01
MB_YESNOCXL = 0x03
MB_YESNO = 0x04
MB_HELP = 0x4000
ICON_EXLAIM=0x30
ICON_INFO = 0x40
ICON_STOP = 0x10
MB_TOPMOST=0x40000
"""
HEX VALUE LINK
https://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm
"""
writeLogs = WriteLogs(
pathLog = app_config['path_logs'] +"\"+strftime("%Y_%m_%d")+".log",
timedate = time.strftime("%m/%d/%Y %I:%M:%S %p")
)
writeLogs.appendLogA(msg)
ctypes.windll.user32.MessageBoxA(None, msg+str(operatorMessage), "[Error]", MB_OK | ICON_STOP | MB_TOPMOST)
我尝试将 MB_TOPMOST 更改为 MB_SYSTEMMODAL 并且我想要的输出带有最上面和重叠的消息错误框。
你可以参考这个link: https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505%28v=vs.85%29.aspx
还有 Whosebug 上的这个 post 给了我一个想法: Have Win32 MessageBox appear over other programs
def msgbox(self,msg):
MB_OK = 0x0
MB_OKCXL = 0x01
MB_YESNOCXL = 0x03
MB_YESNO = 0x04
MB_HELP = 0x4000
ICON_EXLAIM=0x30
ICON_INFO = 0x40
ICON_STOP = 0x10
MB_TOPMOST=0x40000
MB_SYSTEMMODAL=0x1000
"""
HEX VALUE LINK
https://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm
"""
writeLogs = WriteLogs(
pathLog = app_config['path_logs'] +"\"+strftime("%Y_%m_%d")+".log",
timedate = time.strftime("%m/%d/%Y %I:%M:%S %p")
)
writeLogs.appendLogA(msg)
ctypes.windll.user32.MessageBoxA(None, msg+str(operatorMessage), "[Error]", MB_OK | ICON_STOP | MB_SYSTEMMODAL)