DelphiでOLEサーバを作ろう
ここでは、Delphi 5.0 でOLEサーバを作成する方法を示します。 【手順】 @ [ファイル]-[新規作成]を選択
A [ActiveX]-[オートメーション オブジェクト]を選択
B [オートメーション オブジェクト ウィザード]でCoClassを設定
C タイプライブラリとソースコードが作成される
D インターフェイス オブジェクトにメソッドを追加する
E Cで自動生成されたソースコードを更新 ソースコードの更新ボタンを押す
|
[自動生成されたソースコード] unit Unit2; interface uses ComObj, ActiveX, Project1_TLB, StdVcl; type TOleIO_Test = class(TAutoObject, IOleIO_Test) protected procedure AppRun; safecall; { Protected 宣言 } end; implementation uses ComServ; procedure TOleIO_Test.AppRun; begin end; initialization TAutoObjectFactory.Create(ComServer, TOleIO_Test, Class_OleIO_Test, ciMultiInstance, tmApartment); end. |
|
unit Unit2; interface uses ComObj, ActiveX, Project1_TLB, StdVcl, Dialogs; type TOleIO_Test = class(TAutoObject, IOleIO_Test) public procedure AppRun; safecall; protected { Protected 宣言 } end; implementation uses ComServ; procedure TOleIO_Test.AppRun; begin ShowMessage('OK !!!!!'); end; initialization TAutoObjectFactory.Create(ComServer, TOleIO_Test, Class_OleIO_Test, ciMultiInstance, tmApartment); end. |