相关代码:#import "E:\Projects\Demo\MyDLL\Debug\MyDLL.dll"
using namespace MyDLL;AfxOleInit();IOMx1Ptr m_p;
long ret = m_p.CreateInstance(__uuidof(IOMx1)); // 返回失败:
// ret : -2147221164 (0x80040154) 没有注册类别 为什么会出错呢?
应该怎么改??<UP有分>
using namespace MyDLL;AfxOleInit();IOMx1Ptr m_p;
long ret = m_p.CreateInstance(__uuidof(IOMx1)); // 返回失败:
// ret : -2147221164 (0x80040154) 没有注册类别 为什么会出错呢?
应该怎么改??<UP有分>
把你的 MyDLL.dll 对应的 .tlb用 classwizard引入
应该用类ID来创建。
m_p.CreateInstance(__uuidof(OMx1));
试试
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q194/8/73.ASP&NoWebContent=1我又用了,ClassWizard添加Class,
有好多方法都没有了:(比如"AuthenPwd",被注释了)
// method 'AuthenPwd' not emitted because of invalid return type or parameter type是不是DLL本身有问题?
在VB里可以引用,并生成实例.
显示注册成功
DllRegisterServer in c:\winnt\system32\whxx.dll succeeded.实际注册成功,应该在注册表里看到什么?
如果能够用
m_p.CreateInstance(__uuidof(OMx1));
在注册表里看到的是什么样子?
(1)Analyst() 意见是对的,应该使用
m_p.CreateInstance(__uuidof(OMx1));
(2)skt01(skt001)的意见是对的
应该保证在DLL的目录下,有文件MSVBVM60.dll
(3)建议:
将DLL文件拷贝到c:\WINNT\SYSTEM32
注册 regsvr32 c:\WINNT\system32\whxx.dll
VC中 #import "c:\WINNT\system32\whxx.dll" no_namespace