需要创建 COM DLL 以在“Excel.Application”等脚本中使用
我想使用 VSS 2010 创建 COM DLL 并且需要注册到注册表。我的目标是我想使用创建的 DLL,如“Excel.Application”、“Word.Application”、“Wscript.Shell”之类的。
我想使用 CreateObject / New OleObject 方法创建实例,并在我的脚本(VBScript 或 JavaScript)中使用相同的方法。
谁能帮我创建一个 COM 对象以及如何注册它?
我尝试创建 COM 对象并尝试使用 RegSvr32.exe 进行注册。它说“dll已加载,但未找到入口点。请确保有效的dll或ocx”
这是我的代码供您参考...
<ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _
Public Class ComClass1
Public Const ClassId As String = "b3b13b6c-6de5-47cb-ad6f-0ae5c7ce5c59"
Public Const InterfaceId As String = "68536b50-1b47-42d5-970f-d3d34b56d681"
Public Const EventsId As String = "413fa5c3-76fa-44d0-b753-1f3d3f52dbaf"
' A creatable COM class must have a Public Sub New() with no parameters,
' otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
Public Sub Test1()
Console.WriteLine("Test1....")
End Sub
End Class
谢谢,
尚穆加维尔
I want to create a COM DLL using VSS 2010 and need to register to Registry. My aim is I want use that created DLL like "Excel.Application", "Word.Application", "Wscript.Shell" kind-of.
I want to create instance using CreateObject / New OleObject methods and use the same in my Scripting (VBScript or JavaScript).
Any one help me to create a COM object and how to register it?
I tried to create COM Object and tried to register using RegSvr32.exe. It says "dll was loaded but no entry point found. Make sure valid dll or ocx"
Here is my code for your ref...
<ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _
Public Class ComClass1
Public Const ClassId As String = "b3b13b6c-6de5-47cb-ad6f-0ae5c7ce5c59"
Public Const InterfaceId As String = "68536b50-1b47-42d5-970f-d3d34b56d681"
Public Const EventsId As String = "413fa5c3-76fa-44d0-b753-1f3d3f52dbaf"
' A creatable COM class must have a Public Sub New() with no parameters,
' otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
Public Sub Test1()
Console.WriteLine("Test1....")
End Sub
End Class
Thanks,
Shanmugavel.C
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
之后,
现在注册表项将在 CLSID 和接口下完成。然后
就这样......我们可以使用 COM 应用程序......
请参阅链接:
http://www.codeproject.com/KB/COM/nettocom.aspx
http://www.15seconds.com/issue/040721.htm
After this,
Now Registry Entries will be done under CLSID and Interface. Then
That's all.... We can use the COM application....
Refer the links:
http://www.codeproject.com/KB/COM/nettocom.aspx
http://www.15seconds.com/issue/040721.htm