Hello,
I have an OCX that was originally written in Visual C++ 6. After upgrading to VS.Net 2003 everything worked fine and I was able to register my OCX. Recently, I tried to upgrade to VS.Net 2005 but had a lot of trouble registering my OCX. I managed to fix many problems related to the OCX registration but I ended up with the following situation:
If I compile in "Debug" mode, the compile succeeds and the OCX gets registered (I can see this in the registry). However, when I try to test the OCX using ActiveX Control Test Container I get a debug assertion in File: f:\rtm\vctools\vc7libs\ship\atlmfc\include\afxwin1.inl Line: 21
Note that f: is my CD\DVD drive. You can also notice the VC7Libs in the path which refers to the previous version of VS.Net I guess.
When I compile the same OCX in "Release" mode, I get a runtime error in regsvr32 while VS.Net is attempting to register the OCX. The error is:
R6033
- Attempt to use MSIL code from this assembly during native code initialization...
Note that I'm compiling the OCX with "No CLR support" but it depends on other DLLs which are compiled with /clr.
I did some tracing and found that the crash is happening inside DllRegisterServer which does not use any managed code. I also noticed that AfxGetInstanceHandle is returning NULL which might be causing the crash.
I tried compiling my OCX with /clr but VS.Net hangs while trying to register it.
I'm using the VS.Net integrated registration in the project settings instead of using regsvr32 in the post build steps.
I really appreciate your help.
Regards,
Wassim