如何在.Net Windows应用程序中使用ocx

发布于 2024-09-02 08:23:44 字数 329 浏览 6 评论 0原文

我必须在.Net应用程序中使用ocx。在工具箱中,我右键单击并从 com 选项卡添加了 ocx.现在ocx出现在工具箱中并将控件添加到窗体中。当我执行应用程序时,出现此错误“无法加载文件或程序集“Interop.WINCMP3XLib,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null”或其依赖项之一。系统找不到指定的文件。'。你能帮我看看还需要做什么吗?

我还使用 Aximp 工具将包装器 dll 转换为 ocx。现在当我使用这个dll时,我无法访问dll中的方法。

请任何人告诉我在 .Net 应用程序中使用 ocx 的最佳方法。

谢谢

I have to use a ocx in .Net application. In the toolbox, i right clicked and from com tab added the ocx. Now the ocx appeared in the toolbox and added the control to the form. When i execute the application got this error 'Could not load file or assembly 'Interop.WINCMP3XLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.'. Can you help me what else needs to be done.

I also used the Aximp tool to convert the wrapper dll for the ocx. Now when I used this dll, i could not access the method in the dll.

Please can anyone tell me the best way for using ocx in .Net application.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

万人眼中万个我 2024-09-09 08:23:44

通常你要做的是:

  1. 像 RHaguiuda 所说的那样注册控件 - 但是,我的经验是最好将其放置在 C:\Windows\System32
  2. 然后,将 COM 控件添加到工具箱
  3. 将其从工具箱添加到窗体

现在两个将出现您的项目的引用 - 当然,相应的 DLL 也必须出现在您的项目的输出文件夹中。然而,这将自动完成。编译项目时。

我从来没有使用过 aximp...

请注意,当您使用 64 位操作系统时,您必须

  1. 将 OCX 放置在 C:\Windows\SysWOW64 中,并在那里调用 regsrv32.exe
  2. 更改您的项目以进行编译仅在项目设置中为 32 位

这对我有用 - 我希望它也对你有用:-)

Usually what you do is:

  1. Register the control like RHaguiuda said - however, I've experienced that this is best placed in C:\Windows\System32
  2. Then, add the COM control to the toolbox
  3. Add it to the form from the toolbox

Now two references will appear for your project - of course the respective DLLs must then also be present in the output folder for your project. This, however, will be done automatically. When compiling the project.

I've never had to use aximp...

Please note that when you use a 64-bit operating system, you have to

  1. Place the OCX in C:\Windows\SysWOW64 and also call regsrv32.exe there
  2. Change your project to compile for 32-bit only in the project settings

This works for me - I hope it will work for you too :-)

不必在意 2024-09-09 08:23:44

您是否尝试过在 Windows 中注册 OCX?

您可以运行以下命令来执行此操作: regsvr32 "c:\myocx.ocx",替换为您的 OCX 文件。这也可以用于 DLL 文件。

Have you tried to register the OCX within windows?

You can do that running: regsvr32 "c:\myocx.ocx", replacing with your OCX file. This can be used too with DLL files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文