Archive for 4月 25th, 2012
-
Hello, Win32 API(F#) World!
Posted on 4月 25th, 2012 by cx20
Win32 API(F#)
Win32 API は、Windows の機能にアクセスする為の API(Application Programming Interface)である。
以下は F# にて DllImport 属性を用いた呼出し例である。ソースコード
open System open System.Runtime.InteropServices [<DllImport("user32.dll")>] extern int MessageBox( UInt32 hWnd, String lpText, String lpCaption, UInt32 uType) let x = MessageBox( 0u, "Hello, Win32 API(F#) World!", "Hello, World!", 0u )
コンパイル方法
C:¥> fsc Hello.fs
実行結果
--------------------------- Hello, World! --------------------------- Hello, Win32 API(F#) World! --------------------------- OK ---------------------------