Microsoft KB Archive/201191

= You receive a "0x80040154 (Class not registered)" error message when you register an ATL server =

Article ID: 201191

Article Last Modified on 4/28/2005

-

APPLIES TO

 Microsoft ActiveX Template Library 3.0, when used with:  Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul>

 Microsoft Visual C++ .NET 2002 Standard Edition</li></ul>

 Microsoft Visual C++ .NET 2003 Standard Edition</li></ul> </li> Microsoft ActiveX Template Library 2.0, when used with:  Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 5.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 <li>Microsoft Visual C++ 6.0 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2002 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2003 Standard Edition</li></ul> </li> <li>Microsoft ActiveX Template Library 2.1, when used with: <ul> <li>Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

<ul> <li>Microsoft Visual C++ 5.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2002 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2003 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q201191

<div class="symptoms_section">

SYMPTOMS
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.

<div class="cause_section">

CAUSE
ATL70.dll is not installed, or it is not registered.

Note For Visual Studio 6.0 and earlier, the ATL runtime is contained in ATL.dll. If you use Visual Studio 6.0 or earlier, use ATL.dll instead of the later Visual Studio .NET version.

<div class="resolution_section">

RESOLUTION
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).

Note The following steps apply only to Visual Studio 6.0 and earlier. Visual Studio .NET does not have a MinDependency build target.

As an alternative, do not use ATL.dll. When you rebuild your ATL server with a build target of ReleaseMinDependency, the code in ATL.dll is statically linked to your project.

Even for a 'Release MinDependency' ATL.dll may need to be shipped.

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

244955 PRB: MinDependency Project May Need to Include Atl.dll

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

MORE INFORMATION
ATL has a registrar component that is used during registration. This component resides in ATL.dll. During registration, the error 0x80040154 is returned from CoCreateInstance when it fails to create the registrar component.

Location of ATL.DLL in the Visual C++ 5.0 CD:
OS\SYSTEM (UNICODE version)

OS\SYSTEM\ANSI (ANSI version)

Location of ATL.DLL in the Visual C++ 6.0 CD:
DevStudio\VC\Redist (UNICODE version)

DevStudio\VC\Redist\Ansi (ANSI version)

Location of ATL70.DLL in the Visual C++ .NET CD:
Win\System (UNICODE version)

Win\System\ansi (ANSI version)

<div class="references_section">