VB6应用程序在某些计算机上无法运行,但在其他计算机上运行良好

发布于 2024-12-03 03:59:17 字数 745 浏览 1 评论 0原文

我有一个 VB6 应用程序,安装程序是使用 INNO Setup 编译的。 安装程序运行良好。但在大约 10% 的计算机中,当用户单击图标运行已安装的应用程序时,它不会启动,没有错误消息,只有蜂鸣声。

这种情况发生在 XP 和 Win 7 上。

我在 XP 和 Win 7 中开发,应用程序运行正常,所以我无法重现该问题。

安装程序会注册所需的所有 ocx 和 dll(据我所知)。 (嗯,不完全是,它假设 MS 运行时组件应该在那里,但我想如果缺少某些东西,应该会显示一条错误消息)

我在考虑某种用户权限,UAC,但即使是管理组中的用户也有有问题。

您能否指出需要查找和测试哪些可能的问题才能修补应用程序。

谢谢!

[跟进]

感谢提示,发现清单导致了问题。我用它来使控件看起来更好:

http://www.vbaccelerator.com/home/vb/code/libraries/xp_visual_styles/using_xp_visual_styles_in_vb/article.asp

现在我试图找出原因。我有另一个具有相同清单的应用程序,并且该应用程序工作正常。

尚无法获得有关事件查看器的反馈。

I have a VB6 application, the installer is compiled using INNO Setup.
The installer runs fine. But in about 10% of computers when the user clicks the Icon to run the installed app, it doesn't start, no error message, only a Beep sound.

This is happening on XP and also Win 7.

I develop in XP and Win 7 and the application works OK, so I haven't been able to reproduce the issue.

The installer registers all ocx and dlls needed (afaik). (Well not completely all, it assumes MS run-time components should be there, but I guess an error message should show up if something is missing)

I was thinking some kind of user permissions, UAC, but even users in the admin group have had the issue.

Could you point me to what possible issues to look for and test in order to patch the app.

Thanks!

[FOLLOW UP]

Thanks to the tips, found out the manifest is causing the problem. I use it to make the controls look better:

http://www.vbaccelerator.com/home/vb/code/libraries/xp_visual_styles/using_xp_visual_styles_in_vb/article.asp

Now I'm trying to discover why. I have another application with the same manifest and that one works ok.

Haven't been able to get feedback on the event viewer yet.

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

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

发布评论

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

评论(2

╰◇生如夏花灿烂 2024-12-10 03:59:17

“崩溃蜂鸣声”通常表示应用程序清单中存在错误,例如 XML 语法错误或命名空间冲突。事件日志通常会提供有关此的提示。

但我发现人们经常尝试使用 Common Controls 6.0 库而不确保正确的库加载顺序。

在打开任何表单之前,您应该加载 shell32,然后加载 comctl32。最简单的方法是在 Sub Main 中进行几次无操作调用:

Option Explicit

Private Declare Sub InitCommonControls Lib "comctl32" ()

Private Declare Function IsUserAnAdmin Lib "shell32" () As Long

Private Sub InitCommonControlsVB()
    IsUserAnAdmin
    InitCommonControls
End Sub

Private Sub Main()
    InitCommonControlsVB
    Form1.Show
End Sub

如果没有这个,您的程序通常可以在 Vista 或 Win7 中正常工作,但在某些 XP 服务包和补丁级别上会失败。部分原因是处理 SxS 激活和 comctl32.dll 补丁的 Fusion 子系统随着时间的推移而发生变化。

忽略那些说您需要调用 InitCommonControlsEx() 的说法,除非您直接构建和使用 Win32 控件而不是 VB6 和 COM 控件,否则没有必要。

The "beep crash" often points to an error in an application manifest such as an XML syntax error or namspace conflict. Event Logs will often provide a hint about this.

But I've found that people often try to use the Common Controls 6.0 Library without ensuring proper library loading sequence.

Before any Forms are openend you should load shell32 and then comctl32. The easiest way is a couple of no-op calls in Sub Main:

Option Explicit

Private Declare Sub InitCommonControls Lib "comctl32" ()

Private Declare Function IsUserAnAdmin Lib "shell32" () As Long

Private Sub InitCommonControlsVB()
    IsUserAnAdmin
    InitCommonControls
End Sub

Private Sub Main()
    InitCommonControlsVB
    Form1.Show
End Sub

Without this your program will usually work fine in Vista or Win7, but will fail on some XP service pack and patch levels. Part of this is due to changes over time in the Fusion subsystem that handles SxS activation and comctl32.dll patches.

Ignore those saying you need to call InitCommonControlsEx(), it isn't necessary unless you are constructing and using Win32 controls directly instead of VB6 and COM controls.

无声情话 2024-12-10 03:59:17

尝试缩小范围的一些事情:

检查 Windows 事件日志中是否有崩溃事件

检查 Windows 事件日志(在应用程序部分)中是否有来自应用程序的崩溃报告。在 Windows XP 上,您可以通过单击开始 > 快速进入日志查看器。 运行,输入 eventvwr 并按 Enter。在 Windows 7 上,您可以在开始菜单的搜索框中键入“事件查看器”。您可以过滤事件以仅显示程序中的错误事件。

您可能会在其中一台已发生此问题的计算机上发现一些错误事件,因为听起来这些计算机上的错误报告功能已关闭(在这种情况下,事件日志中会记录诸如访问冲突之类的“硬崩溃”)只要计算机上未安装调试器,就不会向最终用户显示错误对话框)。

确保在操作系统级别打开“错误报告”

正如上一节中提到的,听起来这些计算机上的错误报告功能已关闭。在这种情况下,崩溃根本不会向最终用户显示任何类型的消息,并且应用程序将突然消失。在 Windows XP 中,您可以检查此设置(并将其打开),如下所示:

  1. 右键单击“我的电脑”并选择属性
  2. 打开高级选项卡,然后单击错误报告按钮。
  3. 选择启用错误报告选项。
  4. 对所有打开的窗口单击确定

向应用程序添加跟踪代码

您还可以向应用程序的启动代码添加一些跟踪代码,例如用于显示消息框或将消息写入 Windows 事件日志或日志文件的代码应用程序启动后(例如,在主窗体的 Form_Initialize 事件中,或在 Sub Main 例程中)。

通过这种方式,您将能够判断您的应用程序是在加载 VB6 运行时之前还是之后崩溃:如果您尝试启动该应用程序并且它消失/崩溃,并且您的启动消息未记录,那么您就知道它之前崩溃过它甚至有机会获取应用程序的启动代码,这可能表明 VB6 运行时的依赖项或 VB6 运行时本身未正确安装。

请注意,Windows XP 和 Windows 7 都预装了 VB6 运行时,但行为不当的安装程序可能会覆盖或删除属于 VB6 运行时的文件。

A few things to try to narrow it down:

Check the Windows Event Log for crash events

Check the Windows Event Log (in the Application section) for crash reports from your application. You can quickly get to the log viewer on Windows XP by clicking Start > Run, typing eventvwr and pressing Enter. On Windows 7, you can type "event viewer" in the search box that is in the Start menu. You can filter the events to only show error events from your program.

You might find a few error events on one of the computers where this problem has already occured, because it sounds like the error reporting feature is turned off on these computers (in which case "hard crashes" like access violations are logged in the Event Log instead of displaying an error dialog to the end-user, as long as a debugger isn't installed on the computer).

Make sure "Error Reporting" is turned at the OS level

As mentioned in the previous section, it sounds like the error reporting feature is turned off on these computers. In that case, a crash won't display any kind of message to the end-user at all and the application will just vanish suddenly. In Windows XP, you can check this setting (and turn it on) as follows:

  1. Right-click "My Computer" and select Properties.
  2. Open the Advanced tab and click the Error Reporting button.
  3. Select the Enable Error Reporting option.
  4. Click OK to all the open windows.

Add trace code to your application

You could also add some trace code to your application's start-up code, such as code to display a message box or write a message to the Windows Event Log or to a log file as soon as your application starts (for example, in the Form_Initialize event of your main form, or in a Sub Main routine).

This way you will be able to tell whether your application is crashing before or after the VB6 runtime is loaded: if you try to start the application and it disappears/crashes, and your startup message isn't logged, then you know it's crashing before it even has a chance to get to your application's startup code, which could indicate that a dependency of the VB6 runtime or the VB6 runtime itself is not installed properly.

Note that Windows XP and Windows 7 both ship with the VB6 runtime pre-installed, but it's possible for misbehaving installers to overwrite or remove files that are part of the VB6 runtime.

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