source: cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/HTMLEdit/EwbClasses.pas@ 669

Last change on this file since 669 was 541, checked in by Kevin Toppenberg, 15 years ago

TMG Ver 1.1 Added HTML Support, better demographics editing

File size: 5.1 KB
Line 
1//*************************************************************
2// EwbClasses *
3// *
4// Freeware unit *
5// For Delphi 5 - 2009 *
6// by *
7// Serge Voloshenyuk *
8// Developing Team: *
9// Serge Voloshenyuk (SergeV@bsalsa.com) *
10// Eran Bodankin (bsalsa) -(bsalsa@gmail.com) *
11// *
12// Documentation and updated versions: *
13// *
14// http://www.bsalsa.com *
15//*************************************************************
16{LICENSE:
17THIS SOFTWARE IS PROVIDED TO YOU "AS IS" WITHOUT WARRANTY OF ANY KIND,
18EITHER EXPRESSED OR IMPLIED INCLUDING BUT NOT LIMITED TO THE APPLIED
19WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
20YOU ASSUME THE ENTIRE RISK AS TO THE ACCURACY AND THE USE OF THE SOFTWARE
21AND ALL OTHER RISK ARISING OUT OF THE USE OR PERFORMANCE OF THIS SOFTWARE
22AND DOCUMENTATION. BSALSA PRODUCTIONS DOES NOT WARRANT THAT THE SOFTWARE IS ERROR-FREE
23OR WILL OPERATE WITHOUT INTERRUPTION. THE SOFTWARE IS NOT DESIGNED, INTENDED
24OR LICENSED FOR USE IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE CONTROLS,
25INCLUDING WITHOUT LIMITATION, THE DESIGN, CONSTRUCTION, MAINTENANCE OR
26OPERATION OF NUCLEAR FACILITIES, AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS,
27AIR TRAFFIC CONTROL, AND LIFE SUPPORT OR WEAPONS SYSTEMS. BSALSA PRODUCTIONS SPECIFICALLY
28DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR SUCH PURPOSE.
29
30You may use/ change/ modify the component under 3 conditions:
311. In your website, add a link to "http://www.bsalsa.com"
322. In your application, add credits to "Embedded Web Browser"
333. Mail me (bsalsa@gmail.com) any code change in the unit for the benefit
34 of the other users.
354. Please, consider donation in our web site!
36{*******************************************************************************}
37//$Id: EwbClasses.pas,v 1.1.2.1 2006/11/29 22:13:01 sergev Exp $
38
39unit EwbClasses;
40
41interface
42
43{$I EWB.inc}
44
45uses
46 Windows;
47
48type
49 IInterfaceObjectReference = interface
50 ['{C0D28425-8410-45F6-BD60-8AE66782E545}']
51 function GetObject: TObject;
52 end;
53
54 TInterfacedDispatchObject = class(TObject, IUnknown,
55 IInterfaceObjectReference, IDispatch)
56 protected
57 {IInterface}
58 FRefCount: Integer;
59 function QueryInterface(const IID: TGUID; out Obj): HResult;
60{$IFDEF RESEARCH_MODE} virtual; {$ENDIF} stdcall;
61 function _AddRef: Integer; stdcall;
62 function _Release: Integer; stdcall;
63 {IInterfaceObjectReference}
64 function GetObject: TObject;
65 {IDispatch}
66 function GetTypeInfoCount(out Count: Integer): HResult; stdcall;
67 function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult; stdcall;
68 function GetIDsOfNames(const IID: TGUID; Names: Pointer;
69 NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; virtual; stdcall;
70 function Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer;
71 Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult;
72 virtual; stdcall;
73 public
74 procedure AfterConstruction; override;
75 class function NewInstance: TObject; override;
76 property RefCount: Integer read FRefCount;
77 end;
78
79implementation
80
81{ TInterfacedDispatchObject }
82
83class function TInterfacedDispatchObject.NewInstance: TObject;
84begin
85 Result := inherited NewInstance;
86 TInterfacedDispatchObject(Result).FRefCount := 1;
87end;
88
89procedure TInterfacedDispatchObject.AfterConstruction;
90begin
91 InterlockedDecrement(FRefCount);
92end;
93
94function TInterfacedDispatchObject._AddRef: Integer;
95begin
96 Result := InterlockedIncrement(FRefCount);
97end;
98
99function TInterfacedDispatchObject._Release: Integer;
100begin
101 Result := InterlockedDecrement(FRefCount);
102 if Result = 0 then
103 Destroy;
104end;
105
106function TInterfacedDispatchObject.QueryInterface(const IID: TGUID;
107 out Obj): HResult;
108begin
109 if GetInterface(IID, Obj) then
110 Result := 0
111 else
112 Result := E_NOINTERFACE;
113end;
114
115function TInterfacedDispatchObject.GetIDsOfNames(const IID: TGUID;
116 Names: Pointer; NameCount, LocaleID: Integer; DispIDs: Pointer): HResult;
117begin
118 Result := DISP_E_UNKNOWNNAME;
119end;
120
121function TInterfacedDispatchObject.GetObject: TObject;
122begin
123 Result := Self;
124end;
125
126function TInterfacedDispatchObject.GetTypeInfo(Index, LocaleID: Integer;
127 out TypeInfo): HResult;
128begin
129 Result := DISP_E_BADINDEX;
130end;
131
132function TInterfacedDispatchObject.GetTypeInfoCount(
133 out Count: Integer): HResult;
134begin
135 Count := 0;
136 Result := S_OK;
137end;
138
139function TInterfacedDispatchObject.Invoke(DispID: Integer;
140 const IID: TGUID; LocaleID: Integer; Flags: Word; var Params; VarResult,
141 ExcepInfo, ArgErr: Pointer): HResult;
142begin
143 Result := S_OK;
144end;
145
146end.
Note: See TracBrowser for help on using the repository browser.