掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
Delphiで作成したActiveXコントロールをDelphiに載せた時に設計時と実行時を判断するには? (ID:10833)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
いろいろ調べてネットで以下のサンプルを見つけたのですが、 以下のメソッドを実装すると、GetClientSite の結果は正常なのですが、 Site が Nil で戻ってくるため、その先の UserMode まで見られません。 おそらくその UserMode で設計時かわかるようなのです。 どなたかヒントや参考になりそうなサイト情報でもかまいませんのでよろしくお願いいたします。 // This function returns a pointer to a contained control's site function ClientSite( obj: IUnknown ): IOleClientSite; var Site: IOleClientSite; OleObj: IOleObject; begin if (obj.QueryInterface( IOleObject, OleObj ) = S_OK) and (OleObj.GetClientSite( Site ) = S_OK) then Result := Site else Result := nil; end; // This function returns TRUE if the contained object's container is in // design mode; FALSE if the container is not in design mode or // does not support design mode, or on any failure. // function IsControlInDesignMode( obj: IUnknown ): Boolean; var Mode: Boolean; begin try Mode := not ((ClientSite(obj) as IAmbientDispatch).UserMode); except Mode := False; end; Result := Mode; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.