Hello, i made tons of apps in vb6 using this command structure:
Form5.Show 1 'show some modal dialog, it returns a value for a variable 'UserSelection'
Select Case UserSelection
Case 1: blah blah
Case 2: blah blah
SomeOtherForm.Show 'non modal form to be displayed
In Windows XP, no problem at all. My client has Windows 7 and some times, not all times, it returns an error message saying "Cant display non modal form when modal form is displayed".
How this can be wrong in Windows 7 ONLY ? When Form5 is displayed, the instruction pointer stop there until the form finishes and after unloads then goes to the Select-Case and then displayes the non modal form.
Whats wrong in Windows 7? Some incombatibility? The Form5 has no special objects, just a listbox and two buttons Accept/Cancel. No timer objects.
I am thinking to test a DoEvents after the Form5.Show 1 command or some Sleep 300 in order to delay and let the environment unload the form........ but still dont get it whats wrong.
If there is no fix for that, i will have to display the dialog form as non modal and do some fake waiting until i get a user selection.
Hmm, its surely a Win7 incombatibility. This behavior happends too when MsgBox comes up and then after closes it shows a non modal form or just activates the last one opened. Also tried running the .exe declaring WinXP SP3 compatibility, no change.
Last edited by dtv; December 17th, 2012 at 05:44 AM.
An operator please consider the thread as [RESOLVED] and maybe change the main title to "WebBrowser ActiveX causes the container form to not unload successfully if the status of the control is 'busy'".
Totally unfair for Windows 7, totally unfair for the pretty clever VB6 IDE, totally unfair for me having much headaches when seeing VB to popup "cant display non modal form when modal form is displayed". We all, not responsible for some bad behavior of heavy controls who changes the whole stability package of the language.
I was pretty sure that no modal forms was on screen at the time a non modal form was ready to be displayed:
When my app starts up, a modal form containing a web browser control, opens a specific Google page for a user login. If the login succeeds, the browser redirects to a page that ieframe.dll cant understand correctly - showing script error popup message. If the user closes the dialog form, with the webbrowser 'busy' status set to 'true' (because of the script errors), normally anyone thinks that the modal form unloads ok and the code continues. Partially true, the code continues (how come?) but with the modal form not completely unloaded.
Solution for this webbrowser control behavior found in an article: A timer control with interval 5, stops itself and sets the .silent property to true. That causes also the .busy property to be 'false' even the user closes the modal form by force. And finally, the modal form closes successfully and completely vanishing the 'cant show non modal form when modal form is displayed" messages.
But the one and only that is strange, as programmers saying ..always: "it worked on my computer!". Meaning, how come this whole behavior appeared only in my client's PC (with windows 7) and not on my computer with windows xp and vb6 installed... The most difficult thing is to trying trap an error when that error not shows anywhere itself.
They have a newer version of the browser, which is called automagically after they upgraded. I had the same issue about 4 years ago when an app quit working for a client. As soon as I upgraded, the app broke on my end, too!