1

I have a huge application developed using Old VB6 which runs as stand alone application but now I have implemented new licensing process in C# for our products.

Now the problem is migrating those old VB6 lines to .NET is next to impossible as they generate huge list of errors and debugging will take years.

The trick to control licensing for old projects can be done via a container application which validates the license and then executes old vb6 exe with some secure command line arguments.

My question is - is there any other way doing this ? And also is there any encryption system which works both in vb6 and c# (currently have 128 bit AES)?

seopower
  • 127
  • 4
  • 14
  • There is no absolutely secure way for the VB6 exe to know that it has been launched by the container. The user could just attach a debugger to the VB6 exe and look at the command line arguments. Windows guru Ray Chen [writes about this here](http://blogs.msdn.com/b/oldnewthing/archive/2014/02/21/10501953.aspx). Try creating a licensing DLL in C# and calling that from the VB6 as advised in the answers below. – MarkJ Mar 05 '14 at 11:15
  • I was trying to create the COM Interop registration DLL, but my coding has Registry read write and compiler is giving error about Access denied for registry IO class, dont know why ! – seopower Mar 06 '14 at 09:36

2 Answers2

3

What you need is called COM Interop. Basically the ability to create an assembly in .net, then register it as you would an ActiveX dll (although the method is a little different), and invoke from VB6.

This answer has a reasonable run down of it, or there is a section on it in MSDN here

Community
  • 1
  • 1
Jon Egerton
  • 40,401
  • 11
  • 97
  • 129
  • 1
    +1 In other words, create a C# DLL containing the licensing code, and call it from the VB6 via COM interop. – MarkJ Mar 05 '14 at 11:12
2

You can make your C# licensing code as a dll that is COM visible. This is done by changing the ComVisible attribute to true in the AssemblyInfo.cs file.

After registering your .dll with RegAsm.exe, you will be able to call into your C# code from VB6.

Sploofy
  • 493
  • 5
  • 13