Take the 2-minute tour ×

I'm new to VB6 but i'm currently in charge of maintaining a horror of editor like tool with plenty of forms, classes, modules and 3rd party tools all chunk together like the skin faces on that guy in the texas chainsaw massacre...

What i don't understand is why i get different results when i run the app in debugging mode, vs when i compiled it and run it on my devevelopment pc vs when i installed it on a different pc.

Yes i know i'm dumb, so please direct me to where i can find out more about this. I'm hoping to find out something like different linking, registry related etc connection that i'm simply not getting right now, i.e. something like wax on, wax off :P

The main pain in the neck is when i'm trying to debug some errors from my QA and i need to find a spare pc to test this on plus i can't directly debug because i don't know where the code is if i do it that manner.


share|improve this question
Related question: Vb 6 Make .exe different results to debugger –  dummy Feb 8 '09 at 10:02
add comment

2 Answers

up vote 2 down vote accepted

i run the app in debugging mode vs when i compiled it and run it on my devevelopment pc

When you compile you have the option of compiling to native code or pcode. The debugger runs using pcode only. Under rare circumstances when you compile to native code there will be a change in behavior. This particular is really rare. I used VB6 since it's release and I may get it once or twice a year. My application is a complex CAD/CAM creating shapes and running metal cutting machine and has two dozen DLLs. Not a typical situation. At home with my hobby software I never ran into this problem.

There are another class of errors that result from event sequencing problems. While VB6 isn't truly multi-tasking it has the ability to jump out of the current code block to process a event. If it re-enters the same block for the new event interesting things (to say the least) can result. I think this is the likely source of your problems as you software is an editor which is a highly interactive type of software.

In general the problem is fixed by reordering the effected areas. You find the effected area by inserting MsgBox or write to a text file to log where you are. I recommend logging to a text file as MsgBox tend to alter behavior that are timing or multi-tasking related.

Remember if a event fire while VB6 in the middle of a code block and there a DoEvents floating around then it will leave the code block process the event and return to the original code block. If it re-enters the same code block and you didn't mean for this to happen then you will have problems. And you will have different problems on different computers as the timing will be different for each.

The easiest way to deal with this type of issues is create some flag variables. In multi-tasking parlance they are known as semaphores or mutexes. WHen you enter a critical section of code, you set it true. When you leave the routine you set it to false. If it is already true when you enter that section of code you don't execute it.

when i installed it on a different pc.

These are usually the result of the wrong DLL installed. Most likely you have an older version while the target has a newer version. I would download the free Virtual PC and create a clean Window XP install to double check this.

If your problem is event timing this too can be different on different computers. This is found by logging (not MsgBox) suspect regions.

If you can display a screen shot or the text of your specific errors then I can help better.

share|improve this answer
@RS thanks as of now i don't have any, but i've encountered quite a few and decided it's time for me to open my mind by hook or crook. –  melaos Feb 5 '09 at 14:30
add comment

The first thing to check would be the versions of all the dlls that your app depends on - including the service pack version of the VB6 dll.

Have you any more specific details about what's behaving differently?

share|improve this answer
Some that i see often are the exit condition, like i could exit fine on my dev pc. But when i exit on the installed version, it died violently. –  melaos Feb 5 '09 at 10:14
As in a 'Send error report to Microsoft'-type death? Have you unloaded all your forms (not always necessary, but sometimes is)? –  Ant Feb 5 '09 at 12:46
Nope, just different type of exit death which behavior differs from running in ide mode. –  melaos Feb 9 '09 at 1:21
I think we might need more details to get anywhere with this... –  Ant Feb 9 '09 at 9:54
add comment

Your Answer


