Skip to content

Instantly share code, notes, and snippets.

@mfcallahan
Last active February 17, 2023 09:21
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfcallahan/de375491ec10137e584ec861c8bab142 to your computer and use it in GitHub Desktop.
Save mfcallahan/de375491ec10137e584ec861c8bab142 to your computer and use it in GitHub Desktop.
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