Archive for 6月 24th, 2012

  1. Hello, Win32 API(Boo) World!

    Posted on 6月 24th, 2012 by cx20

    Win32 API(Boo)

    Win32 API は、Windows の機能にアクセスする為の API(Application Programming Interface)である。
    以下は Boo による Win32 API の呼出し例である。

    ソースコード

    import System.Runtime.InteropServices
     
    [DllImport("User32.dll", EntryPoint:"MessageBox")]
    def MessageBox(hwnd as int, text as string, caption as string, type as int):
        pass
     
    MessageBox(0, "Hello, Win32 API(Boo) World!", "Hello, World", 0)

    コンパイル方法

    C:¥> booc Hello.boo

    実行結果

    ---------------------------
    Hello, World!
    ---------------------------
    Hello, Win32 API(Boo) World!
    ---------------------------
    OK   
    ---------------------------