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

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

问题描述

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



当我将项目编译到OCX文件,然后运行OUTLOOK时,事情工作正常:我可以看到我的OCX为Outlook选项中的选项卡。



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



我怀疑这是因为在调试时,OCX正在被创建,而Outlook不喜欢这样做。 / p>

在这种情况下,是否有一个很好的技巧来使用OCX上的VB6调试器?

解决方案

调试DLL或OCX时,VB6调试器有时会片刻。




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

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.

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"

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

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

解决方案

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

  • 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.
  • EDIT: 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天全站免登陆