小编Mar*_*lon的帖子

VB6中的.NET对象不使用regasm.exe?

我正在为学校建立软件的软件公司,所以我们的客户端机器通常被锁定,这使得我们几乎不可能在其上安装任何东西.

我们的旧系统主要基于(非常大的)MS Access项目,因此只需从本地文件夹运行即可解决访问问题.

我已经被赋予了将一些系统重新开发到c#.NET的任务 - 但是在过渡阶段能够让访问项目解开.NET事件会很好.

我今天玩了几个小时的com interops但是afaik使这些工作的唯一方法是用RegAsm.exe注册它们 - 不幸的是,这不是客户端环境中的一个选项.

我已经尝试过GetObject/CreateObject但在引用dll或tlb文件时都不起作用,还有其他方法可以实现吗?

理想的解决方案是将com interop dll放在与Access项目相同的目录中.

是的,在有人说之前,我知道MS Access是邪恶的,只适用于非常小的项目 - 但我4个月前才来到这里......

马龙

c# vb6 com ms-access interop

3
推荐指数
2
解决办法
3429
查看次数

Webpack + Typescript:获取模块解析失败 - 为什么?

我正在使用 Typescript 和 Webpack 构建一个 knockoutJs 项目,但遇到了一个非常奇怪的问题。

webpack 失败的模块是这样的:

import esPlayerVM from "./components/es-player";
import esPlayerTemplate from "./components/es-player.tmpl.html";
import fsButtonVm from "./components/fullscreen-button";
import fsButtonHtml from "./components/fullscreen-button.tmpl.html";


export default class Registrator {

    static Register() {
        var koComp = (elName: string, vm: any, html: string) => {
            ko.components.register(elName, { viewModel: vm, template: html });
        }

        koComp('es-player', esPlayerVM, esPlayerTemplate);
        koComp('fullscreen-button', fsButtonVm, fsButtonHtml);
        //ko.components.register('es-player', { viewModel: esPlayerVM, template: esPlayerTemplate });
        //this.RegisterComponent('fullscreen-button', fsButtonVm, fsButtonHtml);
    }
}
Run Code Online (Sandbox Code Playgroud)

Webpack 输出如下:

ERROR in ./ComponentRegistration.ts
Module parse failed: C:\Users\Marlon\Documents\Projects\eps-ko\src\ComponentRegistration.ts Unexpected …
Run Code Online (Sandbox Code Playgroud)

javascript typescript webpack

3
推荐指数
1
解决办法
1万
查看次数

IntPtr.ToInt32() Marshal.ThrowExceptionForHR() - 查询 GAC

我一直在使用我在网上找到的一些代码来使用 fusion.dll 查询 GAC,但是我最近收到了一些错误报告,抱怨溢出异常。

    // If assemblyName is not fully qualified, a random matching may be returned!!!!
    public static String QueryAssemblyInfo(String assemblyName)
    {
        ASSEMBLY_INFO assembyInfo = new ASSEMBLY_INFO();
        assembyInfo.cchBuf = 512;
        assembyInfo.currentAssemblyPath = new String('\0',
        assembyInfo.cchBuf);
        IAssemblyCache assemblyCache = null;
        // Get IAssemblyCache pointer
        IntPtr hr = GacApi.CreateAssemblyCache(out assemblyCache, 0);
        if (hr == IntPtr.Zero)
        {
            hr = assemblyCache.QueryAssemblyInfo(1, assemblyName, ref assembyInfo);
            if (hr != IntPtr.Zero)
                Marshal.ThrowExceptionForHR(hr.ToInt32());
        }
        else
            Marshal.ThrowExceptionForHR(hr.ToInt32());
        return assembyInfo.currentAssemblyPath;
    }
Run Code Online (Sandbox Code Playgroud)

有问题的代码是当它实际上是 Int64 时试图将 IntPtr 转换为 Int32,但问题是 Marshal.ThrowExceptionForHR 只接受 …

.net c# interop gac fusion

2
推荐指数
1
解决办法
683
查看次数

Designer在InitializeComponent中创建一些字段,而不是创建全局变量

我有一个问题,Visual Studio(2010)WinForms设计器在设计器文件中全局创建一些控件(或至少它们的字段),以及从构造函数调用的InitializeComponent方法中的一些控件.

有没有人知道设计师为什么在方法中而不是全局地在本地创建它们?有没有办法阻止它这样做?

它在某些形式上执行此操作但不是全部,并且似乎只发生在Label控件上.受影响的表单的开发人员肯定他们没有做任何不同的事情.

我可以手动修复它,但宁愿知道问题的根源.我需要能够从另一个使用反射访问字段的方法访问字段.

.net c# visual-studio-2010 visual-studio winforms

2
推荐指数
1
解决办法
1155
查看次数