Archive for 5月 30th, 2012
-
Hello, COM(Delphi) World!
Posted on 5月 30th, 2012 by cx20
COM(Delphi)
COM(Component Object Model)はマイクロソフトの提唱するプログラム部品の仕様である。
COM を用いて開発された部品であれば言語を問わず利用することができる。
以下は Delphi による COM クライアントの例となっている。ソースコード
program hello; uses Windows, ComObj, ActiveX; var shell: Variant; folder: Variant; begin CoInitialize(0); shell := CreateOleObject('Shell.Application'); folder := shell.BrowseForFolder( 0, 'Hello, COM(Delphi) World!', 0, 36 ); CoUninitialize(); end.
実行方法
C:¥> dcc32 hello.pas
実行結果
+----------------------------------------+ |Browse For Folder [X]| +----------------------------------------+ | Hello, COM(Delphi) Wolrd! | | | | +------------------------------------+ | | |[Windows] | | | | +[addins] | | | | +[AppCompat] | | | | +[AppPatch] | | | | +[assembly] | | | | : | | | | : | | | | : | | | +------------------------------------+ | | [Make New Folder] [ OK ] [Cancel] | +----------------------------------------+