开发者

VB6 application won't run in some computers, in others it runs fine

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开发者_如何学C 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜