// 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;
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;
如果有,把yourocx.lic拷贝到%windir%\system32下面