Monday, March 15, 2010 11:04 AMHi,
We are in the process of moving our application to be built using Visual Studio 2008.
In the past, we used Visual Studio 6.0 .
In out architecture, the all COM classes are in one DLL which is link statically into the main application.
When the application is built using VS 6.0, and being run using the /RegServer switch, the COM classes are registered as expected and the LocalServer32 points to the exe.
When the application is built using VS 2008, the LocalServer32 points to the dll which is wrong and thus the all COM API doesn't work.
I found that the reason of that is that in the CComModule::UpdateRegistryFromResourceS method, the HINSTANCE is the one of the dll that contains the all COM classes.
So if I override the CComModule::UpdateRegistryFromResourceS method and set the HINSTANCE to be the one of the exe, the register is done as expected and the LocalServer32 points to the exe.
The problem is that when I use either CreateObject in VB or CoCreateInstance, I see in the task manager that the application is being started for a second and exits immediately.
I have no idea what can cause that and after a lot of debugging I found nothing.
The application is written in C++.
If someone can help, I will appreciate it very much.
Friday, March 19, 2010 1:38 AMHi Zvika,
I have some few questions to clarify the issue:
1- You mentioned above that you are statically linking to a dll.It is not clear what you mean by that. Do you have a library where the COM classes are defined and you are statically linking your app to this lib? or does your application links to the dll ( = dynamic linking) ? Could you please send me how you compile/link your app.
2- What is the HRESULT value returned from CoCreateInstance?
3- Could you please send the registry file for your app/dll?