今天用VC6做了一个com组件,使用ATL模板创建,结果在使用regsvr32.exe注册时死活注册不上,返回0x80040154,使用Error Lookup查看错误号结果是“没有注册类别”,百思不得其解,即使以前可以注册的组件现在也无法注册了,怀疑是操作系统的问题。
上网搜索了半天,最终还是在微软的官方网站上找到了一点儿蛛丝马迹:“ When you register an ATL server, you might get error
0x80040154 (Class not registered). For DLLs, REGSVR32.exe returns this error.
For EXEs, the call to _Module::RegisterServer(CComModule::RegisterServer) in
_tWinMain() returns this error.”,接着往下看 “Install ATL70.dll (or ATL.dll for earlier versions of
Visual Studio) in the Windows\System or Winnt\System32 directory. You do not
have to register ATL70.dll, however, you must register ATL.dll by using
Regsvr32.exe. There are UNICODE and ANSI versions of ATL70.dll and ATL.dll.
Install the appropriate version on the target operating system (that is,
UNICODE for Microsoft Windows NT, and ANSI for Microsoft Windows 95 or
Microsoft Windows 98).”
哦,原来是system32下面的atl.dll没有注册,打开C:\windows\system32\找到atl.dll后使用regsvr32注册,然后再注册我的组件,成功!
结论:怀疑在安装、卸载软件或使用优化软件进行系统清理的时候不小心反注册了atl.dll,导致使用atl模板创建的com组件均无法注册。
ps:两年前就遇到过此问题,当时无法搞定,只得重装系统,今天总算找到问题的原因了
上网搜索了半天,最终还是在微软的官方网站上找到了一点儿蛛丝马迹:“ When you register an ATL server, you might get error
0x80040154 (Class not registered). For DLLs, REGSVR32.exe returns this error.
For EXEs, the call to _Module::RegisterServer(CComModule::RegisterServer) in
_tWinMain() returns this error.”,接着往下看 “Install ATL70.dll (or ATL.dll for earlier versions of
Visual Studio) in the Windows\System or Winnt\System32 directory. You do not
have to register ATL70.dll, however, you must register ATL.dll by using
Regsvr32.exe. There are UNICODE and ANSI versions of ATL70.dll and ATL.dll.
Install the appropriate version on the target operating system (that is,
UNICODE for Microsoft Windows NT, and ANSI for Microsoft Windows 95 or
Microsoft Windows 98).”
哦,原来是system32下面的atl.dll没有注册,打开C:\windows\system32\找到atl.dll后使用regsvr32注册,然后再注册我的组件,成功!
结论:怀疑在安装、卸载软件或使用优化软件进行系统清理的时候不小心反注册了atl.dll,导致使用atl模板创建的com组件均无法注册。
ps:两年前就遇到过此问题,当时无法搞定,只得重装系统,今天总算找到问题的原因了
没有评论:
发表评论