需要创建COM DLL(VSS 2010),例如"Excel.Application" [英] Need to create COM DLL (VSS 2010) like "Excel.Application"

查看:115
本文介绍了需要创建COM DLL(VSS 2010),例如"Excel.Application"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想使用VSS 2010创建COM DLL,并且需要注册到注册表.我的目标是要使用创建了类似"Excel.Application","Word.Application","Wscript.Shell"之类的DLL.

我想使用CreateObject/New OleObject方法创建实例,并在我的脚本(VBScript或JavaScript)中使用它.

有谁可以帮助我创建一个COM对象以及如何注册它?

我试图创建COM对象,并尝试使用RegSvr32.exe注册.它说"dll已加载,但未找到入口点.请确保有效的dll或ocx"

这是我的代码供您参考...

Hi all,

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

推荐答案

该文件可能已损坏,因此您需要修复该文件,最好从光盘中获取它.

从下面的帖子中摘录

另一个建议的解决方案是在命令提示符下运行 regsvr32%WinDir%\ system32 \ pngfilt.dll .这有望从Vista的源文件中重新设置png功能,并且与上述修复程序一样,它似乎对某些用户有效.但是,当我尝试这样做时,又收到了另一条错误消息:模块C:\ Windows \ system32 \ pngfilt.dll已加载,但未找到入口点dllregisterserver.确保C:\ Windows \ system32 \ pngfilt.dll是有效的DLL或OCX文件,然后重试." 一位同事建议使用系统文件检查器从Vista DVD修复该文件.如果我用这台笔记本电脑获得了Vista DVD,那就太好了.但是我的只带有创建恢复或恢复CD的选项,该选项无法修复该损坏的文件.
修复IE7中的PNG错误 [ ^ ]

免费附件
如何在Windows XP中修复损坏的文件 [ ^ ]
XP DLL库还原:还原并修复所有损坏的DLL文件 [ ^ ]
修复Windows XP和Windows Vista中损坏的DLL库文件 [解释Regsvr32的用法和错误消息 [如何修复丢失/损坏的DLL文件 [
The file may be corrupted so you need to repair that file, better get it from disc.

Quote taken from below post

Another suggested solution was to run regsvr32 %WinDir%\system32\pngfilt.dll in the command prompt. This promised to re-set the png functionality from Vista’s source files, and as with the fix described above, it seems to work for some. But when I tried this, I got yet another error message: "The module C:\Windows\system32\pngfilt.dll was loaded but the entry-point dllregisterserver was not found. Make sure that C:\Windows\system32\pngfilt.dll is a valid DLL or OCX file and then try again." A colleague suggested using the System File Checker to repair that file from the Vista DVD. Which would have been great if I had gotten a Vista DVD with this laptop. But mine only came with the option to create a recovery or restoration CD, which would not fix that corrupt file.
Fixing the PNG bug in IE7[^]

Free attachments
How to fix corrupted files in Windows XP[^]
XP DLL Library Restore : Restore And Repair All Corrupt DLL Files Back[^]
Fix Corrupt DLL Library File In Windows XP and Windows Vista[^](Youtube Video)

Explanation of Regsvr32 usage and error messages[^]
How to fix missing/corrupt DLL files[^]


您是否已按照所有必需的步骤进行操作?看看这篇文章,应该可以帮助您了解是否错过了任何事情

向COM公开.NET组件 [
Have you followed all of the required steps? Have a look at this article which should help you see if you''ve missed anthing

Exposing .NET Components to COM[^]


大家好,

实际上,现在我使用VS2010创建了一个COM dll,它的运行正常.我也可以通过VBScript和JavaScript创建该对象的实例.

现在我要去其他问题了吗?

在我的VB代码中,函数返回2D数组.我必须像
这样在JavaScript中访问它
Hey Guys,

Actually Now I created a COM dll using VS2010 and its working fine. I can create instance of that object from VBScript and JavaScript as well.

Now I am on the way to other problem?

In my VB code, function is returning an 2D array. I have to access this in JavaScript like

var obj = new ActiveXObject("MyProgID")
var values = obj.function1() // throws error



因此function1返回一个String()()数组.在执行我的JavaScript代码时,它会引发错误.未分配变量值.

我该怎么办?

我想将我的VBArray转换为JavaScript数组然后返回吗?

我要在分配代码之前在JavaScript代码中类型转换返回的数组吗?

你能帮我怎么做吗?



So function1 returns a String()() array. While executing my JavaScript code, it throws error. Not assigning to variant values.

How I can do this?

Am i want to convert my VBArray to JavaScript array and then return?
OR
Am i want to type cast the returning array in my JavaScript code before assigning?

Can you help me how to do this?


这篇关于需要创建COM DLL(VSS 2010),例如"Excel.Application"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆