import clr import clrtype import System from System.Reflection import BindingFlags class Win32(object): __metaclass__ = clrtype.ClrClass from System.Runtime.InteropServices import DllImportAttribute DllImport = clrtype.attribute(DllImportAttribute) @staticmethod @DllImport("user32.dll") @clrtype.accepts(System.IntPtr, System.String, System.String, System.UInt32) @clrtype.returns(System.Int32) def MessageBox(hwnd, text, caption, type): raise RuntimeError("Runtime Error") Win32.MessageBox(System.IntPtr.Zero, "Hello, Win32 API(IronPython) World!", "Hello, World!", 0)