Vb6应用程序在IDE中工作,但可执行程序崩溃 [英] Vb6 application works in the IDE but the executable crashes

查看:294
本文介绍了Vb6应用程序在IDE中工作,但可执行程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对visual basic 6项目有一点问题。一切在IDE
工作正常,但可执行程序崩溃每次,当我运行应用程序。应用程序使用回调与C ++ dll通信。



我将编译模式更改为P-Code,仍然存在问题。

$



谢谢大家

解决方案

这听起来像回调可能发生在不同的线程,而不是你的应用程序正在执行。 [编辑:正如我看到吉姆已经建议的那样。]如果是这样的话, kaboom OLE相关或调用到运行时。与多媒体定时器回调相同的故事,fwiw,我怀疑你必须采取相同的预防措施,如果是这样的情况下。



不同线程回调的简短故事是,你需要使用在typelib中声明的PostMessage来向自己发布一个消息,这样Err对象不会被VB设置,然后让回调返回。您在收到发布的消息时进行自己的处理。这里是我使用CCRP计时器库的typelib:


http://vb.mvps.org/tools/files/postmessage.zip


希望有助于...


I have a little problem with visual basic 6 project. Everything works fine in the IDE but the executable crashes every time, when I run the application. The application uses callbacks to communicate with a C++ dll. Even code as simple as showing a message box fails when the callback starts.

I changed the compilation mode to P-Code and still the problem persist.

Any help would be appreciate.

Thank you all

解决方案

This sounds like the callbacks may be occurring on a different thread than your application is executing on. [EDIT: As I see Jim has already suggested.] If that's the case, yeah, kaboom just as soon as you "touch" anything OLE related or call into the runtime. Same story as with multimedia timer callbacks, fwiw, and I'd suspect you'll have to take the same precautions as one would with those if this is the case.

The short story with different thread callbacks is that you'll need to post a message to yourself, using PostMessage declared in a typelib so that the Err object isn't set by VB, then let the callback return. You do your own processing on receipt of the posted message. Here's the typelib I used for this with the CCRP Timers library:

http://vb.mvps.org/tools/files/postmessage.zip

Hope that helps...

这篇关于Vb6应用程序在IDE中工作,但可执行程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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