Here is a link to an example application that reproduces the error : http://sdrv.ms/17j2Ale
I have three projects. One of them is the Windows Forms.NET 2.0 application (.NET application), one is the VB6 Standard EXE application (VB application), and the other is the VB6 ActiveX DLL (VB DLL). The .NET application refers to a VB DLL that is already registered. This VB DLL runs Crystal Reports. A VB application launches a .NET application through the Shell () command. Here's what happens:
If I run the .NET application directly, I can open the Crystal Reports document without any problems. However, when the VB application starts the .NET application through the Shell () command, when the .NET application tries to open the Crystal Reports document, I get an "Out of memory" error message.
Now here's the kicker - it worked on Windows XP, but when we try to run it on the 64-bit version of Windows 7, we run into this problem. I am sure there is a simple solution for this. Any members?
You can go to update 5, where I narrowed down the problem.
Update . I also tried to create a second Windows Forms.NET.NET (.NET Launcher) application and run the .NET application from it through:
Process.Start(@"C:\Path\OtherApp.exe");
and when I tried to open the Crystal Reports document in a .NET application, it still gave me the same error from memory.
Update 2: removed due to update 4
Update 3: So, today I discovered that the reason that the .NET application was open when it was launched directly was because I was running it in Visual Studio. When I tried the executable file outside of Visual Studio, the error is returned. I noticed that Visual Studio started using vshost.exe in 2005 to launch Windows applications to speed up debugging: http://blogs.msdn.com/b/dtemp/archive/2004/08/17/215764.aspx When I disabled the vshost function, a memory error is returned. So I guess the question is, what does this vshost process do that allows it to work with Windows 7?
Update 4: I was able to compile the VB6 DLL with debug information and load the source and debug information in Visual Studio and execute it when the .NET application executes the VB6 code. The Out of Memory exception comes from this line:
Dim myForm As frmTheForm Set myForm = New frmTheForm 'OOM Error right here
Therefore, inside vshost.exe this form can be initialized, but not without it.
Update 5: I narrowed down the issue in Crystal Reports ActiveX Viewer. I started the new VB ActiveX DLL project from scratch and only started with the form. It worked every way. Then I added the Crystal View Viewer 11.5 library - and the resulting error! This is definitely a Report Viewer. I was told that this problem can be fixed with a simple registry setting.
Update 6: I used Procmon.exe from Sysinternals and created a log file that can be found here:
http://sdrv.ms/194aO7A