Hello, Win32 API(Oxygene) World!

Posted on 6月 26th, 2012 by cx20

Win32 API(Oxygene)

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

ソースコード

namespace hello;
 
interface
uses
    System,
    System.Runtime.InteropServices;
 
type
    Hello =  static class
public
    [DllImport('user32.dll')]
    method MessageBox(hwnd: Integer; text: String; caption: String; utype: Integer): Integer; external;
    class method Main(args: array of String): Integer;
end;
 
implementation
 
[STAThread] 
class method Hello.Main(args: array of String): Integer;
begin
    MessageBox( 0, 'Hello, Win32 API(Oxygene) World!', 'Hello, World!', 0 );
end;
 
end.

コンパイル方法

C:¥> oxygene hello.pas

実行結果

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

Tags:

Categories: .NET, Delphi, Oxygene, Win32 API

コメントを残す

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

WP-SpamFree by Pole Position Marketing