procedure TMap.CreateControl;
procedure DoCreate;
begin
FIntf := IUnknown(OleObject) as CMapX;
end;
begin
if FIntf = nil then DoCreate;
end;
//
FIntf:CMapX
procedure DoCreate;
begin
FIntf := IUnknown(OleObject) as CMapX;
end;
begin
if FIntf = nil then DoCreate;
end;
//
FIntf:CMapX
begin
if FIntf = nil then DoCreate;
end;
创建TMap为空就创建,否则就不创建。
创建函数:
procedure DoCreate;
begin
FIntf := IUnknown(OleObject) as CMapX;
end;
包含一个强制类型转换,或者叫做类型强制包装。
IUnknown就是起这个作用的。