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   
---------------------------

Tags:

Categories: .NET, F#, library, Win32 API

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

WP-SpamFree by Pole Position Marketing