VB 6.0 で CLR をホストするコード
ちょっとワケあって、Essential .NET から転載しておく。
Private Sub Form_Load() Dim rt As mscoree.CorRuntimeHost Dim unk As stdole.IUnknown Dim ad As mscorlib.AppDomain Dim s As mscorlib.Stack Set rt = New mscoree.CorRuntimeHost rt.Start rt.GetDefaultDomain unk Set ad = unk Set s = ad.CreateInstance("mscorlib", "System.Collections.Stack").Unwrap s.Push "Hello" s.Push "Goodbye" s.Push 42 MsgBox s.Pop() MsgBox s.Pop() MsgBox s.Pop() End Sub
次の二つを参照設定する必要あり。
- mscoree.tlb
- mscorlib.tlb
- 作者: ドン・ボックス,クリス・セルズ,Don Box,Chris Sells,吉松史彰
- 出版社/メーカー: 日経BP社
- 発売日: 2003/06/14
- メディア: 単行本
- 購入: 10人 クリック: 203回
- この商品を含むブログ (36件) を見る