Skip to content

Instantly share code, notes, and snippets.

@mfcallahan
Last active February 17, 2023 09:21
Embed
What would you like to do?
import ctypes
def main():
WS_EX_TOPMOST = 0x40000
windowTitle = "Python Windows Message Box Test"
message = "Hello, world! This Message box was created by calling the Windows API using the ctypes library."
# display a message box; execution will stop here until user acknowledges
ctypes.windll.user32.MessageBoxExW(None, message, windowTitle, WS_EX_TOPMOST)
print("User clicked OK.")
if __name__ == "__main__":
main()
@mfcallahan
Copy link
Author

This sample Python script will display a Windows API message box:

@hosamn
Copy link

hosamn commented Nov 18, 2022

Nice find 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment