First, create a class library
Then delete the default class, of course, you can also keep
Next Add New Item
Then add the COM class
Just a name, remember, not Chinese, not Chinese, not Chinese
You can write code for any function
<ComClass(aabb.ClassId, aabb.InterfaceId, aabb.EventsId)> _
Public Class aabb
#Region "COM GUID"
' 这些 GUID 提供此类的 COM 标识
' 及其 COM 接口。若更改它们,则现有的
' 客户端将不再能访问此类。
Public Const ClassId As String = "7a18a092-9f71-45e1-98c0-eb7d7e7c8a30"
Public Const InterfaceId As String = "d49ba9e0-5d56-439f-b96a-5f83cf8dc324"
Public Const EventsId As String = "f0e4b02e-2588-4a82-a9c8-69457de2a560"
#End Region
' 可创建的 COM 类必须具有一个不带参数的 Public Sub New()
' 否则, 将不会在
' COM 注册表中注册此类,且无法通过
' CreateObject 创建此类。
Public Sub New()
MyBase.New()
MsgBox("DLL启动事件")
End Sub
Public Function add(a, b)
Return a + b
End Function
Public Function addstring(a As String, b As String) As String
Return a + b
End Function
End Class
Then how is registered, registration method and not the same as traditional COM
First, the first mode change it
X86 release into the
Then generated on the line
Next, in the build directory, add a text document, input
taskkill / f / t / im Wizard button Wizard button 2014.exe // end of the process, because Wizard button open, are not registered or inexplicable errors
C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ regasm .exe DLL written tutorials .dll / unregister 'uninstall
C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ regasm.exe DLL written tutorials .dll / codebase' re-registration update
pause 'waiting for input
If the first registration, no debugging, only the following line of code on the line
C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ regasm.exe DLL written tutorials .dll / codebase
taskkill /f /t /im 按键精灵2014.exe
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe DLL编写教程.dll /unregister
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe DLL编写教程.dll /codebase
pause
Then save it as bat format
Then run the Register
Next we want to open QuickMacro
Look, can normally use
Test function to see
Then how packaged and released to someone else, just need to package these three documents on the line