Solved

Regsistering ATL (regsvr32) Problem: CAtlDllModuleT and DllRegisterServer (atlbase.h) in VS2003 versus VS2005

Posted on 2007-04-09
4
1,229 Views
Last Modified: 2013-12-14
Hi,

I make a new "ATL Project" and add an "ATL Simple Object"  to it using VS2003. I choose options so that it is an attributed object, never aggregates and supports dual interface and do not provide support for COM 1.0. This will generates a .dll  file.

When I use regsvr32.exe to register it, this tools returns without any error but it really does not write the AppID in the registry (the contents of the .rgs file does not seem to be processed).

But when I open this project in VS2005 and build it there without any modification (except that obviously solution is converted to V8.0), regsvr32 returns successfully again but the registry items are now added correctly under the AppID.

As you now the attributed dll objects  of ATL projects use default implementation for DllMain, DllRegisterServer, DllUnRegisterServer, DllCanUnloadNow, and DllGetClassObject using the "module" attribute in class implementation file (CAtlDllModuleT base class):
http://msdn2.microsoft.com/en-us/library/fs2z0f72(VS.71).aspx

Any Ideas of what is the difference between these two cases. Or is there any known bug regarding ATL projects in VS2003. And how can we overcome this problem?
0
Comment
Question by:Ali Fakoor
  • 2
4 Comments
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 18874947
Can you try using depends.exe and see all the depended dll's are there in both the versions of exe/dll?

0
 
LVL 5

Author Comment

by:Ali Fakoor
ID: 18875095
The problematic dll has dependency to "SHLWAPI.DLL" in addition to that of the working one.

 Obviously the problematic one depends on "MSVCR71D.DLL" (since built with VS2003) and the working one depends on "MSVCR80D.DLL" (since built with CS2005)

Many Thanks,
Ali.
0
 
LVL 5

Accepted Solution

by:
Ali Fakoor earned 0 total points
ID: 18876329
OK I could solved my problem :)

The problem was originating from expandable attributed code.
if you assign /FX to compiler switch of your attributed module, you see that DECLARE_REGISTRY_APPID_RESOURCEID is injected in VS2005 but not VS2003. I consider it kind of a BUG in VS2003.

Thanks for your help.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question