小编DFr*_*end的帖子

64位类型库和32位类型库不同步

这个问题让我头疼了几天,我找不到理由.我很确定这是我的机器特有的环境问题,但它仍然导致我的测试问题.

我正在使用Visual Studio 2010 Professional在C#中创建一个DLL.第一版是下面的;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace TestCOM
{
    [ClassInterface(ClassInterfaceType.AutoDual)]
    [System.Runtime.InteropServices.ComVisible(true)]
    [System.Runtime.InteropServices.ProgId("TestCOM.Class1")]
    [System.Runtime.InteropServices.Guid("803A1B2F-1CDA-4571-9084-87500388693B")]
    public class Class1
    {
        public void showMessage()
        {
            MessageBox.Show("Hello from TextCom");
        }

    }
}
Run Code Online (Sandbox Code Playgroud)

这个程序集很好,一切都很好.我运行以下脚本将其注册为COM对象(首先是32位,然后是64位);

C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe TestCOM.dll /codebase /nologo /tlb:TestCOM32.tlb
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe TestCOM.dll /codebase /nologo /tlb:TestCOM64.tlb
Run Code Online (Sandbox Code Playgroud)

然后使用以下脚本进行测试;

dim tc 
set tc = CreateObject("TestCOM.Class1")
tc.showMessage()
Run Code Online (Sandbox Code Playgroud)

我使用csript来测试脚本,所以我可以控制它使用的位深度 - 我用32位测试一次,用64位测试一次.到目前为止一切都很好.

现在,当我修改原始程序集添加一个函数时,如下所示

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace TestCOM
{
    [ClassInterface(ClassInterfaceType.AutoDual)]
    [System.Runtime.InteropServices.ComVisible(true)]
    [System.Runtime.InteropServices.ProgId("TestCOM.Class1")]
    [System.Runtime.InteropServices.Guid("803A1B2F-1CDA-4571-9084-87500388693B")] …
Run Code Online (Sandbox Code Playgroud)

.net c# com regasm

7
推荐指数
1
解决办法
1182
查看次数

使用SwingEventMonitor监控其他应用程序?

如何使用SwingEventMonitor监视在其他JVM中运行的应用程序中的鼠标事件?

我所拥有的演示代码可以监视在自己的JVM中运行的应用程序中的鼠标点击,但是单独启动或通过jnlp启动的应用程序将被忽略.

我如何确保Java为每个应用程序加载我的SwingEventMonitor应用程序,无论它是如何启动的(桌面或jnlp)

java jnlp swing java-web-start

6
推荐指数
1
解决办法
164
查看次数

标签 统计

.net ×1

c# ×1

com ×1

java ×1

java-web-start ×1

jnlp ×1

regasm ×1

swing ×1