📄 testproj1_tlb.~pas
字号:
property AutoSize: WordBool dispid 3;
property AxBorderStyle: TxActiveFormBorderStyle dispid 4;
property Caption: WideString dispid -518;
property Color: OLE_COLOR dispid -501;
property Font: IFontDisp dispid -512;
property KeyPreview: WordBool dispid 5;
property PixelsPerInch: Integer dispid 6;
property PrintScale: TxPrintScale dispid 7;
property Scaled: WordBool dispid 8;
property Active: WordBool readonly dispid 9;
property DropTarget: WordBool dispid 10;
property HelpFile: WideString dispid 11;
property DoubleBuffered: WordBool dispid 12;
property AlignDisabled: WordBool readonly dispid 13;
property VisibleDockClientCount: Integer readonly dispid 14;
property Enabled: WordBool dispid -514;
property Cursor: Smallint dispid 15;
property HelpType: TxHelpType dispid 16;
property HelpKeyword: WideString dispid 17;
property Property1: Integer readonly dispid 19;
property CallActiveX[const Param2: WideString; const Param3: WideString]: WideString dispid 26;
end;
// *********************************************************************//
// DispIntf: ItestEvents
// Flags: (0)
// GUID: {5D088E9E-203F-404E-8BC5-C01EB75A9C8B}
// *********************************************************************//
ItestEvents = dispinterface
['{5D088E9E-203F-404E-8BC5-C01EB75A9C8B}']
procedure OnActivate; dispid 1;
procedure OnClick; dispid 2;
procedure OnCreate; dispid 3;
procedure OnDblClick; dispid 5;
procedure OnDestroy; dispid 6;
procedure OnDeactivate; dispid 7;
procedure OnKeyPress(var Key: Smallint); dispid 11;
procedure OnPaint; dispid 16;
end;
// *********************************************************************//
// OLE Control Proxy class declaration
// Control Name : Ttest
// Help String : test Control
// Default Interface: Itest
// Def. Intf. DISP? : No
// Event Interface: ItestEvents
// TypeFlags : (34) CanCreate Control
// *********************************************************************//
TtestOnKeyPress = procedure(Sender: TObject; var Key: Smallint) of object;
Ttest = class(TOleControl)
private
FOnActivate: TNotifyEvent;
FOnClick: TNotifyEvent;
FOnCreate: TNotifyEvent;
FOnDblClick: TNotifyEvent;
FOnDestroy: TNotifyEvent;
FOnDeactivate: TNotifyEvent;
FOnKeyPress: TtestOnKeyPress;
FOnPaint: TNotifyEvent;
FIntf: Itest;
function GetControlInterface: Itest;
protected
procedure CreateControl;
procedure InitControlData; override;
function Get_CallActiveX(const Param2: WideString; const Param3: WideString): WideString;
procedure Set_CallActiveX(const Param2: WideString; const Param3: WideString;
const Value: WideString);
public
property ControlInterface: Itest read GetControlInterface;
property DefaultInterface: Itest read GetControlInterface;
property Visible: WordBool index 1 read GetWordBoolProp write SetWordBoolProp;
property Active: WordBool index 9 read GetWordBoolProp;
property DropTarget: WordBool index 10 read GetWordBoolProp write SetWordBoolProp;
property HelpFile: WideString index 11 read GetWideStringProp write SetWideStringProp;
property DoubleBuffered: WordBool index 12 read GetWordBoolProp write SetWordBoolProp;
property AlignDisabled: WordBool index 13 read GetWordBoolProp;
property VisibleDockClientCount: Integer index 14 read GetIntegerProp;
property Enabled: WordBool index -514 read GetWordBoolProp write SetWordBoolProp;
property Property1: Integer index 19 read GetIntegerProp;
property CallActiveX[const Param2: WideString; const Param3: WideString]: WideString read Get_CallActiveX write Set_CallActiveX;
published
property ParentColor;
property ParentFont;
property Align;
property DragCursor;
property DragMode;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnStartDrag;
property AutoScroll: WordBool index 2 read GetWordBoolProp write SetWordBoolProp stored False;
property AutoSize: WordBool index 3 read GetWordBoolProp write SetWordBoolProp stored False;
property AxBorderStyle: TOleEnum index 4 read GetTOleEnumProp write SetTOleEnumProp stored False;
property Caption: WideString index -518 read GetWideStringProp write SetWideStringProp stored False;
property Color: TColor index -501 read GetTColorProp write SetTColorProp stored False;
property Font: TFont index -512 read GetTFontProp write _SetTFontProp stored False;
property KeyPreview: WordBool index 5 read GetWordBoolProp write SetWordBoolProp stored False;
property PixelsPerInch: Integer index 6 read GetIntegerProp write SetIntegerProp stored False;
property PrintScale: TOleEnum index 7 read GetTOleEnumProp write SetTOleEnumProp stored False;
property Scaled: WordBool index 8 read GetWordBoolProp write SetWordBoolProp stored False;
property Cursor: Smallint index 15 read GetSmallintProp write SetSmallintProp stored False;
property HelpType: TOleEnum index 16 read GetTOleEnumProp write SetTOleEnumProp stored False;
property HelpKeyword: WideString index 17 read GetWideStringProp write SetWideStringProp stored False;
property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
property OnClick: TNotifyEvent read FOnClick write FOnClick;
property OnCreate: TNotifyEvent read FOnCreate write FOnCreate;
property OnDblClick: TNotifyEvent read FOnDblClick write FOnDblClick;
property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
property OnKeyPress: TtestOnKeyPress read FOnKeyPress write FOnKeyPress;
property OnPaint: TNotifyEvent read FOnPaint write FOnPaint;
end;
procedure Register;
resourcestring
dtlServerPage = 'Servers';
implementation
uses ComObj;
procedure Ttest.InitControlData;
const
CEventDispIDs: array [0..7] of DWORD = (
$00000001, $00000002, $00000003, $00000005, $00000006, $00000007,
$0000000B, $00000010);
CTFontIDs: array [0..0] of DWORD = (
$FFFFFE00);
CControlData: TControlData2 = (
ClassID: '{A6AB836B-1409-4C34-964E-4080591981B1}';
EventIID: '{5D088E9E-203F-404E-8BC5-C01EB75A9C8B}';
EventCount: 8;
EventDispIDs: @CEventDispIDs;
LicenseKey: nil (*HR:$00000000*);
Flags: $0000001D;
Version: 401;
FontCount: 1;
FontIDs: @CTFontIDs);
begin
ControlData := @CControlData;
TControlData2(CControlData).FirstEventOfs := Cardinal(@@FOnActivate) - Cardinal(Self);
end;
procedure Ttest.CreateControl;
procedure DoCreate;
begin
FIntf := IUnknown(OleObject) as Itest;
end;
begin
if FIntf = nil then DoCreate;
end;
function Ttest.GetControlInterface: Itest;
begin
CreateControl;
Result := FIntf;
end;
function Ttest.Get_CallActiveX(const Param2: WideString; const Param3: WideString): WideString;
begin
Result := DefaultInterface.CallActiveX[Param2, Param3];
end;
procedure Ttest.Set_CallActiveX(const Param2: WideString; const Param3: WideString;
const Value: WideString);
{ Warning: The property CallActiveX has a setter and a getter whose
types do not match. Delphi was unable to generate a property of
this sort and so is using a Variant to set the property instead. }
var
InterfaceVariant: OleVariant;
begin
InterfaceVariant := DefaultInterface;
InterfaceVariant.CallActiveX := Value;
end;
procedure Register;
begin
RegisterComponents('ActiveX',[Ttest]);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -