Microsoft KB Archive/922277

From BetaArchive Wiki
Knowledge Base


BUG: Visual Studio .NET 2003 may not list all the type libraries that are embedded as resources in an ATL executable file when you use the Implement Interface wizard to implement an interface in the ATL project

Article ID: 922277

Article Last Modified on 12/12/2006



APPLIES TO

  • Microsoft Visual Studio .NET 2003 Professional Edition
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Academic Edition
  • Microsoft Visual C++ .NET 2003 Standard Edition



SYMPTOMS

Consider the following scenario. You create a Microsoft Active Template Library (ATL) executable file. Two or more type libraries are embedded as resources in the ATL executable file. You register all the type libraries. In Microsoft Visual Studio .NET 2003, you create a new ATL DLL project. You add an ATL simple object to the project, and then you use the Implement Interface wizard to implement an interface.

In this scenario, only one of the type libraries that are embedded in the ATL executable file appears.

Note This problem occurs when you select the Registry option in the Implement Interface wizard. However, all the type libraries are listed correctly when you select the File option in the Implement Interface wizard and then you select the ATL executable file.

WORKAROUND

To work around this problem, modify the RegisterServer method in the ATL executable file. The RegisterServer method should register additional type libraries by passing the .tlb file name to the LoadTypeLibEx method in the szFile parameter.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

  1. Register an ATL executable file that contains multiple type libraries. To do this, click Start, click Run, type Path /regserver, and then click OK.


Note Path represents the path and file name of the ATL executable file. For example, type C:\Test\ATLServer.exe.

  1. Start Visual Studio .NET 2003.
  2. On the File menu, point to New, and then click Project.
  3. Under Project Types, expand Visual C++ Projects, and then click ATL.
  4. Under Templates, click ATL Project.
  5. Type a name for the project, and then click OK. The ATL Project Wizard appears.
  6. Click Application Settings.
  7. Click to clear the Attributed check box, confirm that the server type is Dynamic-link library (DLL), and then click Finish.
  8. On the View menu, click Class View.
  9. In the Class View window, right-click the name of the project, point to Add, and then click Add Class.
  10. Under Categories, expand Visual C++, and then click ATL.
  11. Under Templates, click ATL Simple Object, and then click Open.
  12. Type a name for the object, and then click Finish.
  13. In the Class View window, right-click the name of the ATL Simple Object that you created, point to Add, and then click Implement Interface.
  14. Under Implement interface from, click Registry.


In the Available type libraries list, notice that only one of the type libraries that is contained in the ATL executable file appears in the Interfaces box.

  1. Under Implement interface from, click File, and then open the ATL executable file location.


In the Available type libraries list, notice that both type libraries appear in the Interfaces box.


REFERENCES

For more information about the RegisterServer method, visit the following Microsoft Developer Network (MSDN) Web site:

For more information about the LoadTypeLibEx method, visit the following MSDN Web site:

Keywords: kbexpertiseinter kbtshoot kbbug KB922277