How to use Delphi created ActiveX DLL in .NET environment like VS2010 - visual-studio-2010

I am running 32bit development environment with Win 7 and VS2010.
I was able to register the Delphi created ActiveX in Windows7
regsvr32.exe "C:\Program Files\MyApp\Test\DelphiActiveX.dll"
Then I added reference in my VS2010 Windows Form project.
I tried the c# 4.0 way of using ActiveX with a dynamic object but it is not working. Nothing happens.
// c# 4.0
dynamic myActiveXLink = Activator.CreateInstance(Type.GetTypeFromProgID("DelphiActiveX.DelphiActiveXLink"));
//dynamic myActiveXLink = Activator.CreateInstance(Type.GetTypeFromCLSID(""));
myActiveXLink.SearchByName("FName1", "LName1");
SearchByName method should start a third party application installed on the computer.
EDIT: The CreateInstance() is executed without error.
Now I am getting Exception at the myActiveXLink.SearchByName() call:
Exactly the same code works fine under WindowsXP and VS2010, but fails under Windows7 32bit and VS2010.

Related

mfc120.dll missing for an application built in VS2013

I have a VC++ based application developed in VS2010 which uses some of the win32 component. I ported the code in VS2013 and I built the code after removing all compilation error in Release Mode. Now when I am trying to run the exe in Computer where VS2013 is installed it is working fine where as it is giving an error of mfc120.dll is missing where only VS2010 is installed. I don't think after building the code in Release mode I should get an error of missing dll. I have not tried to run the exe where no Visual Studio is installed.
If you are using the DLL version of the MFC you also need to install the corresponding VS-2013 runtime DLLs vsredist_x86
Or you switch to a complete static build.
I have found out the solution for this problem. Basically the win32 code I was building was using the Configuration Properties->General-> 'Use MFC in a Shared DLL' which I changed to 'Use MFC in a Shared DLL'. All working fine there after

Adobe Reader X plugin works in Win7, not XP?

We have a managed C++ Adobe Reader plugin specifically designed for Reader X / XI. It works fine in Windows 7, but on Windows XP it throws a COM error - Class not registered.
What's strange is that this only happened after we updated the project from a vs2005 project to vs2010. The old vs2005 plugin works just fine. Anyone have any clue as to why that would be? We just used the standard project auto-upgrade when we moved to 2010. All the rest of the code is the same.
Edit: some more notes about the issue
The plugin DLL itself loaded just fine. It was only when we tried to load a .Net 4 dll through COM interop that we experienced the exception.
Previously, the dll that we were trying to load was written in .net 2.0, and that loads just fine in Windows XP. But the .Net 4 dll will only load in Win7. Note that .Net 3.5 seems to work just like 2.0. It's only .net 4 that breaks (we recompiled the exact same code to 2.0, 3.5, and 4.0 to check).
Turns out the problem is a combination of Adobe's Protected Mode and trying to load a .Net 4 DLL through COM interop, but only on Windows XP.
Bizarrely... change any of those variables, and everything works fine. .Net 3.5 and 2.0 both load fine with Protected Mode on. Windows 7 loads the .Net 4 dll fine with Protected Mode on.
Turning off Protected Mode in Adobe for Windows XP fixes the problem so the DLL loads fine.
I hope this helps someone else who runs into this.

Deploy mixed code Visual Studio application

I have a problem running my application on other machines.
I am developing with Visual Studio 2008 in a Win7 x64 machine.
The solution contains several C# projects (the main application is written in C#, all others are library projects) and two c++/CLI libraries. The C++ libraries are Win32 and all C# projects are set to x86 target processor. No third party libraries used. Framework used is v3.5.
The application builds and runs fine on my machine.
I copied the whole "bin\release" folder to a Win7 x86 machine and it ran fine, too.
But when I tried on a XP x86 system, it did not start. No error message, not even showing up shortly in the task manager. The XP system has all updates installed, all available .NET frameworks installed and all Visual Studio Runtimes installed.
I checked with DependencyWalker and the only missing dlls are "IEShim.dll" and "wer.dll" which are only for Vista or higher.
I tried another of my applications that's not using C++ libraries and they work fine. So I guess I am doing something wrong deploying the C++ dlls.
Registering the C++ dlls with "regsvr32" failed with a "DllEntryPoint" not found message. Registering with "regasm" was successful, but had no effect.
What is it that I am missing?
Well, seems like I was a bit hasty stating "no third party components".
Actually it was the SQL Server Compact who was missing its runtime.

Register dll/tlb

I'm attempting to register a GIS based dll on a test computer and I'm having problems loading in the tlb file with ArcGIS 9.3.1 - ArcMap on the test computer. When I attempt to load the tlb file is says "No New Objects Added". I created the dll file using Visual Studio 2010. The tlb file loads fine on my developer computer. I'm registering the dll/tlb on the test computer by using cmd.exe command (see below).
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe C:\Temp\My.dll /tlb:My.tlb/codebase
The registration replies as successful and the item is listed in the Component Category under the MX Commands category. Below is the COM GUIDs portion code that I'm using within my class.
#Region "COM GUIDs"
Public Const ClassId As String = "1bf94bdf-907c-4026-816f-50feb7a2a976"
Public Const InterfaceId As String = "7ba8a4d5-d15c-4d95-a819-a3e7cbe84533"
Public Const EventsId As String = "2ab51582-47e1-490c-899d-a80992c20fdf"
#End Region
The OS of the developer computer is:
Microsoft Windows XP 32bit,
Version 5.1 - Service Pack 3
AND
The OS of the test computer is:
Microsoft Windows XP 64bit,
Version 5.2 - Service Pack 2
Do I need to do a Windows Update on the developer computer (to 5.2) or is there something wrong in my dll/tlb registration method?
Thanks for your help!
UPDATE:
The ArcGIS software on the test computer is installed under the C:\Program Files (x86) location.
I think you need to register it using the 64-bit version of RegASM on your target PC. You should find it in:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727
^^
Note that I'm assuming that you have compiled your code to MSIL (by selecting AnyCPU as the platform). If you have compiled it to target 32-bit, then you will need to change that.
This is because a 64-bit process cannot find registrations performed by the 32-bit version of RegAsm, and vice-versa.

COM on Windows7 and Visual Studio

I registered a COM dll (under administrator) using regsvr32, which I want to use in Visual Studio 2008 (under administrator) for my project in Windows 7. Now, when I try to use the interfaces and classes from the COM, then I can't see any of the methods. When I use the object browser to view the COM classes, then I can see that they are all empty. However when I use the same COM on windows XP using VS2008, then all methods are suddenly available. Does anybody know why this is happening and how to get this working under Windows 7?
There was a problem with the com object that I have been using. Its not supported to work in Win7.

Resources