📄 testimpl.pas
字号:
unit TestImpl;
interface
uses
ComObj, ActiveX, Srv_TLB, StdVcl;
type
TAutoTest = class(TAutoObject, IAutoTest)
protected
function Get_EditText: WideString; safecall;
function Get_ShapeColor: OLE_COLOR; safecall;
procedure Set_EditText(const Value: WideString); safecall;
procedure Set_ShapeColor(Value: OLE_COLOR); safecall;
function Get_ShapeType: TxShapeType; safecall;
procedure Set_ShapeType(Value: TxShapeType); safecall;
procedure ShowInfo; safecall;
end;
implementation
uses ComServ, SrvMain, TypInfo, ExtCtrls, Dialogs, SysUtils, Graphics;
function TAutoTest.Get_EditText: WideString;
begin
Result := FrmAutoTest.Edit.Text;
end;
function TAutoTest.Get_ShapeColor: OLE_COLOR;
begin
Result := ColorToRGB(FrmAutoTest.Shape.Brush.Color);
end;
procedure TAutoTest.Set_EditText(const Value: WideString);
begin
FrmAutoTest.Edit.Text := Value;
end;
procedure TAutoTest.Set_ShapeColor(Value: OLE_COLOR);
begin
FrmAutoTest.Shape.Brush.Color := Value;
end;
function TAutoTest.Get_ShapeType: TxShapeType;
begin
Result := TxShapeType(FrmAutoTest.Shape.Shape);
end;
procedure TAutoTest.Set_ShapeType(Value: TxShapeType);
begin
FrmAutoTest.Shape.Shape := TShapeType(Value);
end;
procedure TAutoTest.ShowInfo;
const
SInfoStr = 'The Shape''s color is %s, and it''s shape is %s.'#13#10 +
'The Edit''s text is "%s."';
begin
with FrmAutoTest do
ShowMessage(Format(SInfoStr, [ColorToString(Shape.Brush.Color),
GetEnumName(TypeInfo(TShapeType), Ord(Shape.Shape)), Edit.Text]));
end;
initialization
TAutoObjectFactory.Create(ComServer, TAutoTest, Class_AutoTest,
ciMultiInstance, tmApartment);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -