IMAGEDISPLAY_TBL.pas
unit ImageDisplay_TLB;
// PASTLWTR : 1.2
// File generated on 8/25/2008 12:34:32 PM from Type Library described below.
// ************************************************************************ //
// Type Lib: C:\Program Files\Borland\Delphi7\Projects\Display4Automation2\Display4Automation3\ImageDisplay.tlb (1)
// LIBID: {0EB7654F-85A7-4DB1-A9D6-4BC950E298B7}
// LCID: 0
// Helpfile:
// HelpString: ImageDisplay Library
// DepndLst:
// (1) v2.0 stdole, (C:\WINDOWS\system32\stdole2.tlb)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface
uses Windows, ActiveX, Classes, Graphics, StdVCL, Variants;
// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
// *********************************************************************//
const
// TypeLibrary Major and minor versions
ImageDisplayMajorVersion = 1;
ImageDisplayMinorVersion = 0;
LIBID_ImageDisplay: TGUID = '{0EB7654F-85A7-4DB1-A9D6-4BC950E298B7}';
IID_IImageDisplayInterface: TGUID = '{E7A22657-E720-4D79-A31F-C232390DB090}';
DIID_IImageDisplayInterfaceEvents: TGUID = '{A9BD6966-B3C9-42D1-BEFD-549F87868AAA}';
CLASS_ImageDisplayInterface: TGUID = '{A3087BD2-823D-4361-9970-E5AC0ED4A75F}';
type
// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
IImageDisplayInterface = interface;
IImageDisplayInterfaceDisp = dispinterface;
IImageDisplayInterfaceEvents = dispinterface;
// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
ImageDisplayInterface = IImageDisplayInterface;
// *********************************************************************//
// Interface: IImageDisplayInterface
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E7A22657-E720-4D79-A31F-C232390DB090}
// *********************************************************************//
IImageDisplayInterface = interface(IDispatch)
['{E7A22657-E720-4D79-A31F-C232390DB090}']
procedure WorkInvoice(company: OleVariant; invType: OleVariant; out docID: OleVariant;
out mStatus: OleVariant); safecall;
procedure SaveVoucher(docID: OleVariant; docIDSeq: OleVariant; company: OleVariant;
bu: OleVariant; vndrNo: OleVariant; invNo: OleVariant;
invDate: OleVariant; vchrID: OleVariant; po_no: OleVariant;
out mStatus: OleVariant); safecall;
procedure UnBusyInvoice(docID: OleVariant; out mStatus: OleVariant); safecall;
procedure GetVndrNameAddr(searchStr: OleVariant; out srchCount: OleVariant;
out vndrNameAddr: OleVariant; out mStatus: OleVariant); safecall;
end;
// *********************************************************************//
// DispIntf: IImageDisplayInterfaceDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E7A22657-E720-4D79-A31F-C232390DB090}
// *********************************************************************//
IImageDisplayInterfaceDisp = dispinterface
['{E7A22657-E720-4D79-A31F-C232390DB090}']
procedure WorkInvoice(company: OleVariant; invType: OleVariant; out docID: OleVariant;
out mStatus: OleVariant); dispid 201;
procedure SaveVoucher(docID: OleVariant; docIDSeq: OleVariant; company: OleVariant;
bu: OleVariant; vndrNo: OleVariant; invNo: OleVariant;
invDate: OleVariant; vchrID: OleVariant; po_no: OleVariant;
out mStatus: OleVariant); dispid 202;
procedure UnBusyInvoice(docID: OleVariant; out mStatus: OleVariant); dispid 203;
procedure GetVndrNameAddr(searchStr: OleVariant; out srchCount: OleVariant;
out vndrNameAddr: OleVariant; out mStatus: OleVariant); dispid 204;
end;
// *********************************************************************//
// DispIntf: IImageDisplayInterfaceEvents
// Flags: (4096) Dispatchable
// GUID: {A9BD6966-B3C9-42D1-BEFD-549F87868AAA}
// *********************************************************************//
IImageDisplayInterfaceEvents = dispinterface
['{A9BD6966-B3C9-42D1-BEFD-549F87868AAA}']
end;
// *********************************************************************//
// The Class CoImageDisplayInterface provides a Create and CreateRemote method to
// create instances of the default interface IImageDisplayInterface exposed by
// the CoClass ImageDisplayInterface. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoImageDisplayInterface = class
class function Create: IImageDisplayInterface;
class function CreateRemote(const MachineName: string): IImageDisplayInterface;
end;
implementation
uses ComObj;
class function CoImageDisplayInterface.Create: IImageDisplayInterface;
begin
Result := CreateComObject(CLASS_ImageDisplayInterface) as IImageDisplayInterface;
end;
class function CoImageDisplayInterface.CreateRemote(const MachineName: string): IImageDisplayInterface;
begin
Result := CreateRemoteComObject(MachineName, CLASS_ImageDisplayInterface) as IImageDisplayInterface;
end;
end.
---------------------------------------------
ImageDisplayInterface.pas
unit ImageDisplayInterface;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, AxCtrls, Classes, ImageDisplay_TLB, StdVcl;
type
TImageDisplayInterface = class(TAutoObject, IConnectionPointContainer, IImageDisplayInterface)
private
{ Private declarations }
FConnectionPoints: TConnectionPoints;
FConnectionPoint: TConnectionPoint;
FEvents: IImageDisplayInterfaceEvents;
{ note: FEvents maintains a *single* event sink. For access to more
than one event sink, use FConnectionPoint.SinkList, and iterate
through the list of sinks. }
public
procedure Initialize; override;
protected
{ Protected declarations }
property ConnectionPoints: TConnectionPoints read FConnectionPoints
implements IConnectionPointContainer;
procedure EventSinkChanged(const EventSink: IUnknown); override;
procedure WorkInvoice(company, invType: OleVariant; out docID,
methodStatus: OleVariant); safecall;
procedure SaveVoucher(docID, docIDSeq, company, bu, vndrNo, invNo, invDate,
vchrID, po_no: OleVariant; out mStatus: OleVariant); safecall;
procedure UnBusyInvoice(docID: OleVariant; out mStatus: OleVariant);
safecall;
procedure GetVndrNameAddr(searchStr: OleVariant; out srchCount,
vndrNameAddr, mStatus: OleVariant); safecall;
end;
var vCompany, vDoc_id, vInvType, vDocID, vDoc_id_seq : Variant;
var vBU, vVndr_no, vInv_no, vInv_dt, vVchr_id, vPO : Variant;
var vSearchStr, vCount, vVndrNameAddr : Variant;
implementation
uses ComServ, ufrmImageDisplay;
procedure TImageDisplayInterface.EventSinkChanged(const EventSink: IUnknown);
begin
FEvents := EventSink as IImageDisplayInterfaceEvents;
end;
procedure TImageDisplayInterface.Initialize;
begin
inherited Initialize;
FConnectionPoints := TConnectionPoints.Create(Self);
if AutoFactory.EventTypeInfo <> nil then
FConnectionPoint := FConnectionPoints.CreateConnectionPoint(
AutoFactory.EventIID, ckSingle, EventConnect)
else FConnectionPoint := nil;
end;
procedure TImageDisplayInterface.WorkInvoice(company, invType: OleVariant;
out docID, methodStatus: OleVariant);
begin
vCompany := company;
vInvtype := invType;
ufrmImageDisplay.WorkInvoice();
docID := sDocID1;
methodStatus := sStatus1;
//hResult := S_OK;
end;
// MORE MORE METHOD CALLS REMOVED TO SHORTEN THE CODE
initialization
TAutoObjectFactory.Create(ComServer, TImageDisplayInterface, Class_ImageDisplayInterface,
ciSingleInstance, tmApartment);
end.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
by: ziolkoPosted on 2008-08-30 at 11:09:39ID: 22352750
in this case you have "safecall" option which means that if HRESULT is different than S_OK an exception will be raised on clcient side, so to answer your question... you have to use try/except and catch EOleException, like this:
try
except
on E: EOleException do
E.ErrorCode
end;
ErrorCode will have value of HRESULT
ziolko.