0x80040154创建64位已注册COM DLL的实例时,类未注册错误 [英] 0x80040154 Class not registered error while creating instance of a 64-bit registered COM DLL

查看:160
本文介绍了0x80040154创建64位已注册COM DLL的实例时,类未注册错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello C ++ Gurus,



我通过在visual studio 2010中编译32位应用程序创建了一个64位COM DLL(Mode-Release,Platform-x64 )并使用Regsvr32.exe工具成功注册。

我正在尝试创建dll的实例但是,我在下面的函数中收到Class Not registered错误:

hr = CoCreateInstance(rclsid,pOuter,dwClsContext,__ uuidof(IUnknown),reinterpret_cast< void **>(& pIUnknown));



我观察到对于32位DLL我在函数中获得clsid为'CLSID _IDispatch ibase32':

hr = CLSIDFromProgID(const_cast< lpwstr>(clsidString),& clsid);

但它给出的类ID不是64位DLL的IDispatch接口。



请有人建议解决方案。



先谢谢。

Hello C++ Gurus,

I created a 64-bit COM DLL by compiling a 32-bit application in visual studio 2010(Mode-Release, Platform-x64) and registered it successfully using Regsvr32.exe tool.
I am trying to create the instance of the dll but, I am getting "Class Not registered " error in the below function:
hr = CoCreateInstance(rclsid, pOuter, dwClsContext, __uuidof(IUnknown), reinterpret_cast<void**>(&pIUnknown));

I observed that for 32-bit DLL I am getting clsid as 'CLSID _IDispatch ibase32' in the function:
hr = CLSIDFromProgID(const_cast<lpwstr> (clsidString), &clsid);
But it gives the Class ID not the IDispatch interface for 64-bit DLL.

Please anybody suggest the solution.

Thanks in Advance.

推荐答案

我仍然(希望会留下来的?)相对于COM来说,相当湿润工作。虽然我注意到您报告的行为与我在Windows XP或7下启动32位COM服务器时观察到的行为相同。



也就是说CLSIDFromProgId就是这样 - 它返回一个classID。一个classID,然后你用它来启动服务器。



我主要使用gcc,所以错过了VS中向导的优点。因此,我必须将我自己的一组辅助函数组合在一起。这是我在启动com服务器时使用的那个。希望它不是完全没用..



I'm still(hopefully will remain?) pretty wet-behind-the-ears with respect to COM work. Though I do note that the behaviour you report is the same as that which I observe when starting a 32bit COM server under either windows xp or 7.

That is to say CLSIDFromProgId does just that - it returns a classID. A classID that you then use later to start the server with.

I work with gcc predominantly, so miss the advantages of the wizards in VS. as a result I've had to put together my own set of helper functions. Here's the one I use when starting a com server. Hope it's not entirely useless..

IDispatch *startServer(wchar_t *serverName)
{
   // Get CLSID for our server...
   CLSID clsid;
   wstring progId, errorMsg;

    progId = serverName;
    progId += L".Application";
   HRESULT hr = CLSIDFromProgID(progId.c_str(), &clsid);

   if(FAILED(hr)) {

      MessageBox(NULL, L"CLSIDFromProgID() failed", L"Error", 0x10010);
      return NULL;
   }

   // Start server and get IDispatch...
   IDispatch *pResult;
   hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IDispatch, (void **)&pResult);
   if(FAILED(hr)) {
       errorMsg = serverName;
       errorMsg += L" not registered properly";
      MessageBox(NULL, errorMsg.c_str(), L"Error", 0x10010);
      return NULL;
   }
    return pResult;
}


如果您尝试从32位dll / exe创建COM对象,则无法实例化64位com对象。

因为Windows为32位和64位COM对象维护单独的条目。因此,请确保您的COM对象和容器应用程序属于相同的体系结构(32位或64位.....不混合)



搜索SysWOW on在网上。
If you are trying to create a COM object from a 32 bit dll/exe , then your 64 bit com object cannot be instantiated .
Because Windows maintain separate entries for 32 bit and 64 bit COM objects. Hence make sure that your COM object and your container application belongs to same architecture (either 32 bit or 64 bit .....not mixed)

Search for SysWOW on on the net.


请参考..



http://www.gfi.com/blog/32bit-object -64bit-environment /



这将真正解决你的问题......
Please refer..

http://www.gfi.com/blog/32bit-object-64bit-environment/

It will really solve your problem...


这篇关于0x80040154创建64位已注册COM DLL的实例时,类未注册错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆