Random Vb6 error , usually for 'load control(array)' statement - vb6

"Failed to load control 'A' from B.OCX. Your version of B.OCX may be
outdated. Make sure you are using the version of the control that was
provided with your application."
This error comes randomly in vb6 application exe, will not repeat when application is closed and opened (i.e can't recreate error)
usually comes for 'load control(array)' statement
What is the cause for this error? (registration of ocx file is done properly, also it works most of the time)
tried the solution given here , but same error repeats.

Related

Debugging on an end-user PC?

A user that works in my company has an Error 13 Type mismatch in the moment that she wants to input some data in a grid.
The thing is that when she has that problem, my application only shows the error screen and nothing more (I mean it doesn't say where the error occurs).
I want to know if there is a way that I can "see" the problem in a debug application because I don't have the source code of my application in this computer and I don't know if the problem is because of a Windows configuration issue or why this error pops up provided that when she uses another terminal, different to the one that she normally uses, she can do her job without problems (they have the same settings in the two pcs).
I have the source code in my terminal but as say above, in my terminal the error doesn't pop up so I need to see it in her terminal.
How can I do this?

Slow shutdown of VB ocx file with MSVBVM60.dll after converting from VBscript to JScript

We have an application that currently works on IE browsers till IE10version.
We have a challange to move towards IE11 as VB support is removed from IE in standard mode.
We had lots of VB scripts that were converted to JScripts. The application also loads VB6 active x components.
After conversion from VB script to JScript, the application runs fine except in places where VB6 active x components are being loaded.
The application crashes every alternate time with "out of memory" issue and does not load the ocx file.
Note: this happens every alternate time.
I used ProcMon tool to see what was happening. I see when the active x component is loaded, the ocx file is loaded and another dll MSVBVM60.dll is also loaded. when the active x component is Shutdown, the MSVBVM60 is also cleaned up along with that.
The next time when we try to load the active x component, the ocx file and MSVBVM60 are not loaded at all and we see the out of memory issue.
We tested the application by opening and closing the active x control once and then waiting for around 30 seconds and then try launching the active x control. This time it worked. With this we felt the component is taking time to shutdown/unload.
If we try to launch the control before it shuts down, the application is giving that error.
This never happened with VB script code.
Is there any relation with MSVBVM60.dll with VBScript that makes it to unload faster compared to JScript?
We could not find any code specific that was different in VB script and JScript.
I need your inputs to think in the right direction. Please help.

Final installation folder debugging

When I install my finished product it runs fine until the very last action is done (a button that 'saves' the job).
The program pops this error up:
Unhandled exception has occurred in your application. If you click continue, the app will ignor this error and attempt to continue. If you click quit, the app will close.
Could not find a part of the path 'C:\Program Files (x86)\ATR\Save A Job\obj\Release\42\ATR\BackupProgram\Backup.xml
For some reason, the program is looking for the backup.xml file in the wrong place. (and seemingly added folders)
The way I'm calling the backup.xml file in the program is by:
(System.Environment.SpecialFolder.ProgramFile sX86 & "\ATR\Save A Job\Backup.xml")
Which, could be the wrong way, but it makes sense to me.
I would assume that the full path to the file location would be as follows:
C:\Program Files (x86)\ATR\Save A Job\backup.xml
However, it is looking for it in the wrong place (obvious from the error)
Anyone know why?
Got it fixed guys. It was the permissions to the installation folder. My user was set to "read/write only"...once i switched it to Full Control, everything worked fine

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 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:
Right-click "My Computer" and select Properties.
Open the Advanced tab and click the Error Reporting button.
Select the Enable Error Reporting option.
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.

VB6 IE frame / WebBrowser causing NT.dll error

We have a legacy VB6 application which has worked just fine on Windows XP Professional SP 3 until just recently when we added an IE frame control so that we could display static local HTML files on a form. And, it works fine until I go to close the application. And, then it reports the following error message (consistently):
Faulting module ntdll.dll, version 5.1.2600.5755, stamp 49901d48
Here's the reference in the Visual Basic project file:
Object={EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0; ieframe.dll
And we use it by performing the following actions:
Development machine is running Win7 + Vb6 IDE.
Add a component reference to the "Microsoft Internet Controls" located at C:\Windows\SysWow64\ieframe.dll
Place a control on the form at design time.
Show that form modally by calling Form.Show vbModal The error happens when I use the default form instance frmMyForm.Show vbModal as well as when I use a local instance Dim MyForm as New frmMyFormMyForm.Show vbModal
Call WebBrowser.Navigate "staticPage.html"
When the user presses a button, the button click event returns the user choice and the form is disposed of.
Exit the application -- Here's where I get the error.
I've been looking all over the web, and haven't been able to find a whole lot of people still trying to use VB6 in this way. So, I'm wondering if someone might be able to help me on stackoverflow. Any help is much appreciated!
[Update] And, the plot thickens. I made a sample application with just that web component in order to make sure that it was causing the error. But, I didn’t experience the error when it closed like I was when exiting our existing/legacy vb6 application. I'll do a bit more investigating.
A follow up to this in case any runs into the same issue (the original poster and I were coworkers at the time)...
The application was using the VBCorLib library, and some of its string manipulation classes utilized direct memory access incorrectly. Read more at this VBCorLib forum post.
It turns out that the issue was that I was trying to delete the temporary file that the browser had loaded. It works now that I've moved that delete file code to the form unload event.

Resources