Very practical stuff! How many problems can be solved by knowing this method in the past? First build a C # DLL project, write a class//test.cs
Namespace Test
... {
public class MyTest
... {
public string Fun ()
... {
return this. ToString ();
}
}
}, compile and then execute vs vsvars32.bat in CMD to set the environment variable, then execute regasm cscomtest.dll/tlb:cscomtest.tlb/codebase
Microsoft (R). NET Framework Assembly Registration Utility 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
REGASM Warning: Registering unsigned assemblies with/codebase may cause assemblies to interfere with the same computer
Other applications that may be installed on the. The/codebase switch is intended only for signed assemblies. Please for your assembly
Provide a strong name and re-register it.
Type was successfully registered
The Assembly has been exported to C:\Documents and Settings\pyw\my Documents\Visual Studio Proje
Cts\cscomtest\bin\debug\cscomtest.tlb ", type library registration succeeded
Then open VB or VBS, write ko! Success, this effect is equivalent to using VB call C #, although it is implemented through COM, it is cool!
Set o = CreateObject ("Test.mytest")
MsgBox O.fun () http://blog.csdn.net/yanjiaye520/article/details/6777819
C # DLLs are registered as Com,delphi to invoke the