modal form, windows 7 problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: modal form, windows 7 problem

  1. #1
    Join Date
    Feb 2003
    Location
    Greece
    Posts
    529

    modal form, windows 7 problem

    Hello, i made tons of apps in vb6 using this command structure:

    blah blah...

    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
    End Select
    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.
    - Better live in the digital world -

  2. #2
    Join Date
    Feb 2003
    Location
    Greece
    Posts
    529

    Re: modal form, windows 7 problem

    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.
    - Better live in the digital world -

  3. #3
    Join Date
    Feb 2003
    Location
    Greece
    Posts
    529

    Re: modal form, windows 7 problem

    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.
    - Better live in the digital world -

  4. #4
    Join Date
    Feb 2003
    Location
    Greece
    Posts
    529

    Re: modal form, windows 7 problem

    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.

    Anyways, still learning no matter the age...
    - Better live in the digital world -

  5. #5
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,958

    Re: modal form, windows 7 problem

    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!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center