TnxOleContainer =class(TOleContainer)
private
procedure CMUIDeactive(var Mesg: TMessage); message CM_UIDEactive; //这个消息在OleContainer里边有相应函数
end;
.....
var
CanUIDeactive: Boolean;
begin
if State < osInplaceAative then
Inherited
else
begin
CanUIDeactive:= True;
if Assigned(FOnUiDeactive) then FOnUIDeactive(CanUIDeactive);
if CanUIDeactive then Inherited;
end;
end;