如何在 Outlook 属性页 OCX 上使用 VB6 调试器? [英] How to use VB6 debugger on Outlook property page OCX?

查看:28
本文介绍了如何在 Outlook 属性页 OCX 上使用 VB6 调试器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 VB6,我创建了一个 Outlook 插件,它有一个属性页.属性页是一个 OCX 控件.

Using VB6, I have created an Outlook plugin, that has a property page. The property page is an OCX control.

当我将项目编译为 OCX 文件,然后运行 ​​OUTLOOK 时,一切正常:我可以在 Outlook 选项中看到我的 OCX 作为选项卡.

When I compile the project to an OCX file, and then run OUTLOOK, things work fine: I am able to see my OCX as a tab in the Outlook options.

但是,当我尝试通过在 VB6 中运行 OCX 进行调试时,出现错误.我的调试是这样开始的:1) 调试选项设置为等待创建组件"2) VB6中的F5-RUN工程.3) 启动 Outlook.4) 获取错误:无法显示MyOcx"页面.此页面将保持可见,但不可用.发生 OLE 注册错误.程序未正确安装.再次为程序运行安装程序"

However, when I try to debug by running the OCX in VB6 I get an error. My debugging is started like this: 1) Debug options set to Wait for components to be created" 2) F5-RUN project in VB6. 3) Start Outlook. 4) Get the error: "Cannot display "MyOcx" page. This page will remain visible, but is not available. An OLE registration error occurred. The program is not correctly installed. Run Setup again for the program"

我怀疑这是因为在调试时,OCX 是在进程外创建的,而 Outlook 不喜欢那样.

I suspect this is because, when debugging, the OCX is being created out-of-proc and Outlook doesn't like that.

在这种情况下,是否有在 OCX 上使用 VB6 调试器的好方法?

Is there a good technique to use the VB6 debugger on the OCX in this scenario?

推荐答案

VB6 调试器在调试 DLL 或 OCX 时有时会不稳定.

The VB6 debugger is sometimes flaky when debugging DLLs or OCXs.

  • 您可以尝试 Windbg,Microsoft 提供的免费独立调试器.将您的 VB6 OCX 编译为本机代码,无需优化并创建符号调试信息"(即创建 PDB 文件),您将能够在 Outlook 中调试您的 OCX 进程内.这是 Microsoft 人员的 2006 年博客文章将 Windbg 与 VB6 一起使用,以及 2004 年博客文章 另一位 Microsoft 人员的简要介绍到 Windbg.
  • 您还可以将 Visual Studio 2008 调试器与 VB6 和 PDB 文件一起使用,例如使用 Visual C++ Express Edition(免费).编辑见克里斯的回答更多细节.
  • Windbg 和 Visual Studio 期望 源代码在调试机器上的路径与构建 OCX 时在构建机器上的路径完全相同.最简单的方法是在同一台机器上构建和调试.否则你可能需要 fiddle 使用 SUBST创建虚拟驱动器 - 或者我被告知严肃的方法是使用 Symbol服务器.
  • (认真的)你可以不用那些新奇的交互式调试器,只需登录到一个文件,或者使用 来自 VB6 的 DebugMessage 调用.
  • You could try Windbg, a free standalone debugger from Microsoft. Compile your VB6 OCX into native code with no optimisation and "create symbolic debug info" (i.e. create PDB files), and you will be able to debug your OCX in-process in Outlook. Here's a 2006 blog post by a Microsoft guy about using Windbg with VB6, and 2004 blog post by another Microsoft guy with a brief introduction to Windbg.
  • You could also use the Visual Studio 2008 debugger with VB6 and PDB files, e.g. with Visual C++ Express Edition (which is free). EDIT see Kris's answer for more details.
  • Both Windbg and Visual Studio expect the source code to be in exactly the same path on the debug machine as it was on the build machine when the OCX was built. The easiest way is to build and debug on the same machine. Otherwise you might need to fiddle with SUBST to create virtual drives - or I'm told the serious way is to use a Symbol Server.
  • (Les serious) you could do without those newfangled interactive debuggers, just log to a file, or with DebugMessage calls from your VB6.

这篇关于如何在 Outlook 属性页 OCX 上使用 VB6 调试器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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