CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    Tenby, Wales
    Posts
    277

    Window loses focus

    I have a dilemma:

    I have a main form that users can select videos from and they open in a new window with a windows media contraol on it.

    The new window is set to open full screen but also has a button on it to return to main menu. I have the media player controls layout set to mini as the user needs to be able to stop the clip playing and for the button to appear to returnt o main menu.

    There are 2 problems inn that if the user double-click during playback, the form seems to lose focus and disappear behind the main form. The other is that if the user clicks on the stop button, the form again seems to lose focus and remains running behind the main form. I need the main form to remain open so that it covers the taskbar so the users cannot get to the start button etc.

    Please help . . . Some code:
    Code:
    The Main form:
    Private Sub cmdTamarRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdTamarRun.Click
            sString = "C:\Lifeboat Video Browser\videos\TamarRun.mpg"
            frmVideo.Show()
        End Sub
    Code:
    The Video Form:
    Public Class frmVideo
    
        Private Sub frmVideo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Me.BringToFront()
            AxWindowsMediaPlayer1.URL = sString
        End Sub
    
        Private Sub cmdMain_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdMain.Click
            frmMain.BringToFront()
            Me.Close()
        End Sub
    End Class

  2. #2
    Join Date
    Dec 2002
    Location
    Tenby, Wales
    Posts
    277

    Re: Window loses focus

    Anybody?????

  3. #3
    Join Date
    Dec 2002
    Location
    Tenby, Wales
    Posts
    277

    Re: Window loses focus

    Sorted it - I had TopMost set to True!!!

    DOH

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

Featured