J
jianyou_chen
Unregistered / Unconfirmed
GUEST, unregistred user!
如果你回答了,我會很快結貼的,
運行時出現 Exception Class EOleSysError with Message '加载类型库/Dll出错' 錯誤。
//第一個單元
unit MyCom_TLB;
interface
const
mycommajorversion = 1;
mycomminorversion = 0;
IID_mycom : TGUID = '{DAA92574-286D-4D28-BC6B-20769779B1F2}';
Class_Mycom : TGUID = '{8155BAB5-9C79-491C-A557-A19368F4B494}';
Type
IMyCom = interface;
IMyComDisp = dispinterface;
MyCom = IMyCom;
IMyCom = interface(IDispatch)
['{DAA92574-286D-4D28-BC6B-20769779B1F2}']
function getname : string;safecall;
end;
IMyComDisp = dispinterface
['{DAA92574-286D-4D28-BC6B-20769779B1F2}']
function getname : string;dispid 201;
end;
coMyCom = class
class function Create : IMyCom;
class function CreateRemote(Const MachineName : string): IMyCom;
end;
implementation
uses ComObj;
class function coMyCom.Create : IMyCom;
begin
result := CreateComObject(Class_MyCom) as IMyCom;
end;
class function coMyCom.CreateRemote(Const MachineName : string) : IMyCom;
begin
result := CreateRemoteComObject(MachineName,Class_MyCom) as IMyCom;
end;
end.
//第二單元
unit interfacetoclass;
interface
uses
ComObj,MyCom_TLB;
type
TMyCom = class(TAutoObject,IMyCom)
protected
function getname : string;safecall;
end;
implementation
uses
ComServ;
function TMyCom.getname;
begin
result := 'great!!you are success!!';
end;
initialization
TAutoObjectFactory.Create(ComServer, TMyCom, Class_MyCom,
ciMultiInstance, tmsingle);
end.
//第三單元
program MyComDPR;
uses
Forms,dialogs,
MyCom_TLB in 'MyCom_TLB.pas',
interfacetoclass in 'interfacetoclass.pas';
{$R *.res}
type
TMyCom1 = class(TMyCom)
function getname :string;
end;
function TMyCom1.getname : string;
begin
result := 'just the first step!!';
end;
var MyCom1 : TMyCom1;
aa : string;
begin
Application.Initialize;
MyCom1 := TMyCom1.Create;
aa := MyCom1.getname;
showmessage(aa);
Application.Run;
end.
不知該怎么注冊,連要注冊什么都不知道,還請高手指點!!!我頂200分
200分
現在問另外一個問題,如何增加一個我的類型庫,能能夠試用的,?????,這個問題再加180分,我的所有!!!!!!!
運行時出現 Exception Class EOleSysError with Message '加载类型库/Dll出错' 錯誤。
//第一個單元
unit MyCom_TLB;
interface
const
mycommajorversion = 1;
mycomminorversion = 0;
IID_mycom : TGUID = '{DAA92574-286D-4D28-BC6B-20769779B1F2}';
Class_Mycom : TGUID = '{8155BAB5-9C79-491C-A557-A19368F4B494}';
Type
IMyCom = interface;
IMyComDisp = dispinterface;
MyCom = IMyCom;
IMyCom = interface(IDispatch)
['{DAA92574-286D-4D28-BC6B-20769779B1F2}']
function getname : string;safecall;
end;
IMyComDisp = dispinterface
['{DAA92574-286D-4D28-BC6B-20769779B1F2}']
function getname : string;dispid 201;
end;
coMyCom = class
class function Create : IMyCom;
class function CreateRemote(Const MachineName : string): IMyCom;
end;
implementation
uses ComObj;
class function coMyCom.Create : IMyCom;
begin
result := CreateComObject(Class_MyCom) as IMyCom;
end;
class function coMyCom.CreateRemote(Const MachineName : string) : IMyCom;
begin
result := CreateRemoteComObject(MachineName,Class_MyCom) as IMyCom;
end;
end.
//第二單元
unit interfacetoclass;
interface
uses
ComObj,MyCom_TLB;
type
TMyCom = class(TAutoObject,IMyCom)
protected
function getname : string;safecall;
end;
implementation
uses
ComServ;
function TMyCom.getname;
begin
result := 'great!!you are success!!';
end;
initialization
TAutoObjectFactory.Create(ComServer, TMyCom, Class_MyCom,
ciMultiInstance, tmsingle);
end.
//第三單元
program MyComDPR;
uses
Forms,dialogs,
MyCom_TLB in 'MyCom_TLB.pas',
interfacetoclass in 'interfacetoclass.pas';
{$R *.res}
type
TMyCom1 = class(TMyCom)
function getname :string;
end;
function TMyCom1.getname : string;
begin
result := 'just the first step!!';
end;
var MyCom1 : TMyCom1;
aa : string;
begin
Application.Initialize;
MyCom1 := TMyCom1.Create;
aa := MyCom1.getname;
showmessage(aa);
Application.Run;
end.
不知該怎么注冊,連要注冊什么都不知道,還請高手指點!!!我頂200分
200分
現在問另外一個問題,如何增加一個我的類型庫,能能夠試用的,?????,這個問題再加180分,我的所有!!!!!!!