Results 1 to 3 of 3

Thread: Window showing on top of application

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2013
    Posts
    2

    Window showing on top of application

    I have a VB6 application consisting of a MDI form, MDI child forms and standard forms. This application has been fine running on operating systems before Windows 7 / Windows 2008 Server R2. On Windows 7 / Windows 2008 Server R2, I am having an issue when showing a modal form. The modal form sometimes does not stay at the foreground and a form that was behind it comes to the front, even if it’s another application.

    For example, I open Microsoft Word. Then I open my application (the MDI form with an MDI child,) which is on top of Word on the screen. I click on a button on the MDI child form that calls a modal popup form. Word comes up on the screen and is now the topmost form, but does not have focus and does not respond to any key press events. The modal popup, although behind Word, is responding to the key press.

    This does not happen every time, but if I click the button on the MDI child and close the modal form over and over I can cause it to happen at some point. My users see it a lot because they are going in and out of screens all day.

    Any idea of what is causing this? It is fine on Windows XP.

  2. #2

    Thread Starter
    New Member
    Join Date
    Jun 2013
    Posts
    2

    Re: Window showing on top of application

    MDIForm1:
    Code:
      
        Private Sub MDIForm_Load()
          Form1.Show
        End Sub
    Form1 (with a single command button):
    Code:
        
        Private Sub Command1_Click()   
            Form2.Display
        End Sub
    Form2 (with a single command button)::
    Code:
          
        Public Sub Display()
          Command1.Caption = "Close Me"
          Me.Show vbModal
        End Sub
      
        Private Sub Command1_Click()
         Unload Me
        End Sub

  3. #3
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Window showing on top of application

    Try:

    Code:
    Me.Show vbModal, Form1
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

Posting Permissions

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



Click Here to Expand Forum to Full Width