?? unitfile.pas
字號:
unit Unitfile;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, ActiveX, Classes, ComObj, TypeComServer_TLB, StdVcl;
type
//TTypeDllServer類的聲明
TTypeDllServer = class(TTypedComObject, ITypeDllServer)
public
Name: WideString;
protected
function GetName: WideString; stdcall;
function GetSalary(Bonus, BaseSalary: Single): Single; stdcall;
procedure SetName(const NewName: WideString); stdcall;
end;
implementation
uses ComServ;
function TTypeDllServer.GetName: WideString;
begin
Result := Name; //返回員工名稱
end;
function TTypeDllServer.GetSalary(Bonus, BaseSalary: Single): Single;
begin
Result := BaseSalary + Bonus; //返回員工的薪水
end;
procedure TTypeDllServer.SetName(const NewName: WideString);
begin
Name := NewName; //設置員工姓名
end;
initialization
TTypedComObjectFactory.Create(ComServer, TTypeDllServer, Class_TypeDllServer,
ciMultiInstance, tmApartment);
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -