델 고수님들의 조언부탁을 드리며 제가 알고 싶은 점을 말씀드립니다.
다음은 소스코드는 ole automation의 클라이언트 입니다.
* 아래에서 IEdit_TLB는 kodakimg.exe의 타입라이브러리입니다. 그 타입 라이브러리안에는 여러 disp인터페이스를 지원합니다. 그래서 그 인터페이스중에서 한 인터페이스를 선택하여 .. 그 안의 메소드를 사용하고자 하는데 .. 문제가 발생하였습니다.
early binding을 사용하는 방법을 사용하기 때문에 문법적인 부분이나.. 제공하지 않는 메소드를 사용하면 에러가 검출되는데.. 컴파일 에러는 없습니다. ..
그런데.. 실행을 하면.. Eole..에러가 나면서 '클래스가 등록되지 않았습니다'라는 말이 나옵니다.. 그래서 레지스트리를 검색해보니.. kodakimg.exe는 ProdID: 'imaging.application'이라는 것으로 등록이 되어있었습니다. ...
그러면 이럴때의 해결책은 무엇인지 알고싶습니다..
참고로 IEdit_TLB 의 소스의 내용도 밑에 있습니다.
----------------------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, IEdit_TLB, StdCtrls, ComObj;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Img: IAImageFileObj;
pagecnt : integer;
begin
Img := CoCAImageFileObj.Create; // <<-- 실행시 에러나는 부분..
Img.Open('c:Test.tif',EmptyParam,EmptyParam,EmptyParam);
pagecnt := img.PageCount;
showmessage(IntToStr(pagecnt));
end;
end.
---------------------------------------------------------------------------------
unit IEdit_TLB;
// ************************************************************************ //
// WARNING //
// ------- //
// The types declared in this file were generated from data read from a //
// Type Library. If this type library is explicitly or indirectly (via //
// another type library referring to this type library) re-imported, or the //
// 'Refresh' command of the Type Library Editor activated while editing the //
// Type Library, the contents of this file will be regenerated and all //
// manual modifications will be lost. //
// ************************************************************************ //
// PASTLWTR : $Revision: 1.11.1.75 $
// File generated on 2000-01-20 오전 10:16:37 from Type Library described below.
// ************************************************************************ //
// Type Lib: C:Program FilesWindows NTAccessoriesImageVuekodakimg.exe
// IIDLCID: {83712FE0-8A46-11CE-BAAF-444553540000}
// Helpfile:
// HelpString:
// Version: 1.0
// ************************************************************************ //
interface
uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL;
// *********************************************************************//
// 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
LIBID_IEdit: TGUID = '{83712FE0-8A46-11CE-BAAF-444553540000}';
DIID_IIEdit: TGUID = '{83712FE1-8A46-11CE-BAAF-444553540000}';
CLASS_CIEditDoc: TGUID = '{2F80A201-2729-101C-87B8-7E460AB7480C}';
DIID_IAAppObj: TGUID = '{7D252A21-A4D5-11CE-8BF1-00608C54A1AA}';
CLASS_CAAppObj: TGUID = '{7D252A20-A4D5-11CE-8BF1-00608C54A1AA}';
DIID_IAImageFileObj: TGUID = '{7D252A22-A4D5-11CE-8BF1-00608C54A1AA}';
CLASS_CAImageFileObj: TGUID = '{7D252A23-A4D5-11CE-8BF1-00608C54A1AA}';
DIID_IAPageObj: TGUID = '{7D252A24-A4D5-11CE-8BF1-00608C54A1AA}';
CLASS_CAPageObj: TGUID = '{7D252A25-A4D5-11CE-8BF1-00608C54A1AA}';
DIID_IAPageRangeObj: TGUID = '{7D252A26-A4D5-11CE-8BF1-00608C54A1AA}';
CLASS_CAPageRangeObj: TGUID = '{7D252A27-A4D5-11CE-8BF1-00608C54A1AA}';
type
// *********************************************************************//
// Forward declaration of interfaces defined in Type Library //
// *********************************************************************//
IIEdit = dispinterface;
IAAppObj = dispinterface;
IAImageFileObj = dispinterface;
IAPageObj = dispinterface;
IAPageRangeObj = dispinterface;
// *********************************************************************//
// Declaration of CoClasses defined in Type Library //
// (NOTE: Here we map each CoClass to its Default Interface) //
// *********************************************************************//
CIEditDoc = IIEdit;
CAAppObj = IAAppObj;
CAImageFileObj = IAImageFileObj;
CAPageObj = IAPageObj;
CAPageRangeObj = IAPageRangeObj;
// *********************************************************************//
// DispIntf: IIEdit
// Flags: (4096) Dispatchable
// GUID: {83712FE1-8A46-11CE-BAAF-444553540000}
// *********************************************************************//
IIEdit = dispinterface
['{83712FE1-8A46-11CE-BAAF-444553540000}']
end;
// *********************************************************************//
// DispIntf: IAAppObj
// Flags: (4096) Dispatchable
// GUID: {7D252A21-A4D5-11CE-8BF1-00608C54A1AA}
// *********************************************************************//
IAAppObj = dispinterface
['{7D252A21-A4D5-11CE-8BF1-00608C54A1AA}']
property ActiveDocument: OleVariant dispid 1;
property Application_: OleVariant dispid 2;
property DisplayScaleAlgorithm: OleVariant dispid 3;
property Edit: WordBool dispid 4;
property ImagePalette: Smallint dispid 5;
property ImageView: Smallint dispid 6;
property Parent: OleVariant dispid 7;
property ScrollBarsVisible: WordBool dispid 8;
property StatusBarVisible: WordBool dispid 9;
property ToolBarVisible: WordBool dispid 10;
property Zoom: Single dispid 11;
property Visible: WordBool dispid 12;
property Height: OleVariant dispid 13;
property Left: OleVariant dispid 14;
property Top: OleVariant dispid 15;
property Width: OleVariant dispid 16;
property TopWindow: WordBool dispid 17;
property FullName: OleVariant dispid 18;
property Name: OleVariant dispid 19;
property Path: OleVariant dispid 20;
property AnnotationPaletteVisible: WordBool dispid 21;
property Maximize: WordBool dispid 22;
property ImagingToolBarVisible: WordBool dispid 23;
property ScanToolBarVisible: WordBool dispid 24;
property AppState: Smallint dispid 25;
property WebToolBarVisible: WordBool dispid 26;
property ScannerIsAvailable: WordBool dispid 27;
function CreateImageViewerObject(ObjectClass: OleVariant): OleVariant; dispid 28;
function FitTo(ZoomOption: Smallint): OleVariant; dispid 29;
function Quit: OleVariant; dispid 30;
function Help: OleVariant; dispid 31;
end;
// *********************************************************************//
// DispIntf: IAImageFileObj
// Flags: (4096) Dispatchable
// GUID: {7D252A22-A4D5-11CE-8BF1-00608C54A1AA}
// *********************************************************************//
IAImageFileObj = dispinterface
['{7D252A22-A4D5-11CE-8BF1-00608C54A1AA}']
property Application_: OleVariant dispid 1;
property ActivePage: Integer dispid 2;
property FileType: Smallint dispid 3;
property PageCount: Integer dispid 4;
property Parent: OleVariant dispid 5;
property Saved: WordBool dispid 6;
property Name: OleVariant dispid 7;
property OCROutputFile: WideString dispid 8;
property OCROutputType: Integer dispid 9;
property OCRLaunchApplication: WordBool dispid 10;
function Pages(StartPage: Integer; EndPage: OleVariant): OleVariant; dispid 11;
function Save: OleVariant; dispid 12;
function Close(SaveChangeFlag: OleVariant): OleVariant; dispid 13;
function Help: OleVariant; dispid 14;
procedure New(DisplayUIFlag: OleVariant); dispid 15;
function Print(DisplayUIFlag: OleVariant): OleVariant; dispid 16;
procedure Open(const ImageFile: WideString; IncludeAnnotation: OleVariant; Page: OleVariant;
DisplayUIFlag: OleVariant); dispid 17;
procedure SaveAs(const ImageFile: WideString; FileType: OleVariant; DisplayUIFlag: OleVariant); dispid 18;
procedure AppendExistingPages(const ImageFile: WideString; Page: Integer; Count: Integer;
DisplayUIFlag: OleVariant); dispid 19;
procedure InsertExistingPages(const ImageFile: WideString; ImagePage: Integer; Count: Integer;
Page: Integer; DisplayUIFlag: OleVariant); dispid 20;
procedure RotateAll; dispid 21;
function FindOIServerDoc: WideString; dispid 22;
procedure Ocr; dispid 23;
procedure CreateContactSheet(const ImageFile: WideString; bIncludeAnnotations: OleVariant;
OpenAfterSave: OleVariant); dispid 24;
procedure SaveCopyAs(const ImageFile: WideString; FileType: OleVariant;
DisplayUIFlag: OleVariant); dispid 25;
function Update: OleVariant; dispid 26;
end;
// *********************************************************************//
// DispIntf: IAPageObj
// Flags: (4096) Dispatchable
// GUID: {7D252A24-A4D5-11CE-8BF1-00608C54A1AA}
// *********************************************************************//
IAPageObj = dispinterface
['{7D252A24-A4D5-11CE-8BF1-00608C54A1AA}']
property Application_: OleVariant dispid 1;
property CompressionInfo: Integer dispid 2;
property CompressionType: Smallint dispid 3;
property ImageResolutionX: Integer dispid 4;
property ImageResolutionY: Integer dispid 5;
property Name: Integer dispid 6;
property PageType: Smallint dispid 7;
property Parent: OleVariant dispid 8;
property Height: Integer dispid 9;
property Width: Integer dispid 10;
property ScrollPositionX: Integer dispid 11;
property ScrollPositionY: Integer dispid 12;
function Delete: OleVariant; dispid 13;
function Flip: OleVariant; dispid 14;
function RotateLeft: OleVariant; dispid 15;
function RotateRight: OleVariant; dispid 16;
function Scroll(Direction: Smallint; Amount: Integer): OleVariant; dispid 17;
function Help: OleVariant; dispid 18;
function Print: OleVariant; dispid 19;
procedure Ocr; dispid 20;
end;
// *********************************************************************//
// DispIntf: IAPageRangeObj
// Flags: (4096) Dispatchable
// GUID: {7D252A26-A4D5-11CE-8BF1-00608C54A1AA}
// *********************************************************************//
IAPageRangeObj = dispinterface
['{7D252A26-A4D5-11CE-8BF1-00608C54A1AA}']
property Application_: OleVariant dispid 1;
property Parent: OleVariant dispid 2;
property Count: OleVariant dispid 3;
property EndPage: OleVariant dispid 4;
property StartPage: OleVariant dispid 5;
function Delete: OleVariant; dispid 6;
function Print: OleVariant; dispid 7;
procedure Ocr; dispid 8;
end;
CoCIEditDoc = class
class function Create: IIEdit;
class function CreateRemote(const MachineName: string): IIEdit;
end;
CoCAAppObj = class
class function Create: IAAppObj;
class function CreateRemote(const MachineName: string): IAAppObj;
end;
CoCAImageFileObj = class
class function Create: IAImageFileObj;
class function CreateRemote(const MachineName: string): IAImageFileObj;
end;
CoCAPageObj = class
class function Create: IAPageObj;
class function CreateRemote(const MachineName: string): IAPageObj;
end;
CoCAPageRangeObj = class
class function Create: IAPageRangeObj;
class function CreateRemote(const MachineName: string): IAPageRangeObj;
end;
implementation
uses ComObj;
class function CoCIEditDoc.Create: IIEdit;
begin
Result := CreateComObject(CLASS_CIEditDoc) as IIEdit;
end;
class function CoCIEditDoc.CreateRemote(const MachineName: string): IIEdit;
begin
Result := CreateRemoteComObject(MachineName, CLASS_CIEditDoc) as IIEdit;
end;
class function CoCAAppObj.Create: IAAppObj;
begin
Result := CreateComObject(CLASS_CAAppObj) as IAAppObj;
end;
class function CoCAAppObj.CreateRemote(const MachineName: string): IAAppObj;
begin
Result := CreateRemoteComObject(MachineName, CLASS_CAAppObj) as IAAppObj;
end;
class function CoCAImageFileObj.Create: IAImageFileObj;
begin
Result := CreateComObject(CLASS_CAImageFileObj) as IAImageFileObj;
end;
class function CoCAImageFileObj.CreateRemote(const MachineName: string): IAImageFileObj;
begin
Result := CreateRemoteComObject(MachineName, CLASS_CAImageFileObj) as IAImageFileObj;
end;
class function CoCAPageObj.Create: IAPageObj;
begin
Result := CreateComObject(CLASS_CAPageObj) as IAPageObj;
end;
class function CoCAPageObj.CreateRemote(const MachineName: string): IAPageObj;
begin
Result := CreateRemoteComObject(MachineName, CLASS_CAPageObj) as IAPageObj;
end;
class function CoCAPageRangeObj.Create: IAPageRangeObj;
begin
Result := CreateComObject(CLASS_CAPageRangeObj) as IAPageRangeObj;
end;
class function CoCAPageRangeObj.CreateRemote(const MachineName: string): IAPageRangeObj;
begin
Result := CreateRemoteComObject(MachineName, CLASS_CAPageRangeObj) as IAPageRangeObj;
end;
end.