Hello, COM(Tcl) World!

Posted on 3月 15th, 2013 by cx20

COM(Tcl)

COM(Component Object Model)はマイクロソフトの提唱するプログラム部品の仕様である。
COM を用いて開発された部品であれば言語を問わず利用することができる。
以下は Tcl にて TWAPI ならび tcom を用いた COM クライアントの例となっている。

ソースコード(Tcl + TWAPI)

package require twapi
set shell [twapi::comobj "Shell.Application"]
set folder [$shell BrowseForFolder  0 "Hello, COM(Tcl) World!" 0 36 ]

ソースコード(Tcl + tcom)

package require tcom
set shell [::tcom::ref createobject "Shell.Application"]
set folder [$shell BrowseForFolder  0 "Hello, COM(Tcl) World!" 0 36 ]

実行方法

C:¥> tclsh hello.tcl

実行結果

+----------------------------------------+
|Browse For Folder                    [X]|
+----------------------------------------+
| Hello, COM(Tcl) Wolrd!                 |
|                                        |
| +------------------------------------+ |
| |[Windows]                           | |
| | +[addins]                          | |
| | +[AppCompat]                       | |
| | +[AppPatch]                        | |
| | +[assembly]                        | |
| |     :                              | |
| |     :                              | |
| |     :                              | |
| +------------------------------------+ |
| [Make New Folder]    [  OK  ] [Cancel] |
+----------------------------------------+

Tags:

Categories: COM, Tcl

コメントを残す

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

WP-SpamFree by Pole Position Marketing