俺初学COM技术内幕,在配书源码的第十一章中的程序总是运行出错,请大侠帮忙解决:-)
编译都是对的
我先执行register.bat注册,然后启动server,在命令行中执行client
选1时client报错如下
To which server do you want to continue?
1) In-proc Server
2) Local Server
:1
Client: Attempt to create in-proc component
CUnknow: Not aggregating: delegate to nondelegating iUnknow.
Component: LoadRegTypeLib Failed, now trying LoadTypeLib.
Error (8002801d): Library not registered.Component: LoadTypeLib Failed.
Error (80029c4a): Error loading type library/DLL.CUnknown: Increment reference count for final realease.
Component: Destroy self.
Client: Could not create component.
Error (80029c4a): Error loading type library/DLL.
我的环境提WinXP+VC6.0
编译都是对的
我先执行register.bat注册,然后启动server,在命令行中执行client
选1时client报错如下
To which server do you want to continue?
1) In-proc Server
2) Local Server
:1
Client: Attempt to create in-proc component
CUnknow: Not aggregating: delegate to nondelegating iUnknow.
Component: LoadRegTypeLib Failed, now trying LoadTypeLib.
Error (8002801d): Library not registered.Component: LoadTypeLib Failed.
Error (80029c4a): Error loading type library/DLL.CUnknown: Increment reference count for final realease.
Component: Destroy self.
Client: Could not create component.
Error (80029c4a): Error loading type library/DLL.
我的环境提WinXP+VC6.0
后面放到C:\目录下,就正确了。如下:C:\CHAP11\CHAP11>client
To which server do you want to connect?
1) In-proc Server
2) Local Server.
:1
Client: Attempt to create in-proc component.
CFactory::CreateInstance
CUnknown: Not aggregating; delegate to nondelegating IUnknown.
Client: Successfully created component.
Client: Use interface IX.
Component: FxStringIn received a string: This is the test.
Client: FxStringOut returned a string: [String from FxStringOut]
Client: Release IX.
CUnknown: Increment reference count for final release.
Component: Destroy self.
应该是注册时汉字路径问题,注册类不支持汉字,双字节字符,你自已改改吧,反正在C:\目录下是对的。