locked
Loading a movie in media player RRS feed

  • Question

  • Hi,

    I have added media player component on my form. But how do i play a movie at a specified loacation using it? I tried setting the URL. I dont know the extension of the file. Properties of movie file just says that it is a windows media file.

    I have many buttons on my form of say size 800 * 600. Now I want to maximize to the current screen resolution. If I just maximize, the contents of the form remain of the same size. I want the buttons and other things to expand according to screen resolution. How do I do this?

    Aditya
    Wednesday, October 10, 2007 4:05 PM

Answers

  •  Aditon wrote:
    Hi,
    I have many buttons on my form of say size 800 * 600. Now I want to maximize to the current screen resolution. If I just maximize, the contents of the form remain of the same size. I want the buttons and other things to expand according to screen resolution. How do I do this?

     

    You want to automatically resize controls based on screen resolution.

     

    I think the Anchor and Dock Properties can help to achieve the goal.

    Please check this thread and the sample: Working with Anchoring and Docking Properties

    To resize controls dynamically with the form, we can use the Anchor property of Windows Forms controls. The Anchor property describes an anchor position for the control. When a control is anchored to a form and the form is resized, the control maintains the distance between the control and the anchor positions.

     

    Another approach: handle Form_Resize event

    This thread and this document: Automatic Scaling in Windows Forms

     

    In addition, check these threads for reference.

    Resize form when screen resolution changes.

    Screen resolution affects GUI

     

     

    Regards,

    Martin

    Thursday, October 11, 2007 6:14 AM
  • Hi Aditya,

     

    To play a movie, we must specify the URL property like this:

    AxWindowsMediaPlayer1.URL = "c:\mediafile.wmv"

     

    Here are some actions for you to try:

     

    1. When you add a WindowsMediaPlayer control to form, please remember to resize it in order to show the play area.

     

    2. Imports namespace like this : imports WMPLib

    Adding the Windows Media Player control from the Toolbox also adds references to two libraries created by Visual Studio, AxWMPLib and WMPLib. You can find them in the Solution Explorer under References.

    To make using the objects in the Player namespace easier, you should include the namespace.

     

    3. Let Windows OS show file extensions.

    Tools menu-> Folder Options -> View tab -> Uncheck "Hidden extensions for known file types"

     

    4. Check this KB article to know about file formats supported by Windows Media Player and try these formats.

    http://support.microsoft.com/kb/316992

         Supported file formats
         File formats that are not supported
         How do I determine what type of file I am playing?

     

    5. If they are not helpful, please send your movie file to my mailbox: v-maxie@microsoft.com

     

    Regards,

    Martin

    Friday, October 12, 2007 2:24 AM

All replies

  •  Aditon wrote:
    Hi,
    I have added media player component on my form. But how do i play a movie at a specified loacation using it? I tried setting the URL. I dont know the extension of the file. Properties of movie file just says that it is a windows media file.

     

    Hi Aditya,

     

    Please try specifying the extension .wmv.

     

    Play the movie

    AxWindowsMediaPlayer1.URL = "c:\mediafile.wmv"

     

    Stop the movie

    AxWindowsMediaPlayer1.Ctlcontrols.stop()

    Check these documents about how to add the component and use it. 

    1. Using the Windows Media Player Control with Microsoft Visual Studio .NET

        http://msdn2.microsoft.com/en-us/library/Bb249583.aspx

    2. Embedding the Windows Media Player Control in a Visual Basic .NET Solution

        http://msdn2.microsoft.com/en-us/library/bb248595.aspx

     

     

    Regards,

    Martin

    Thursday, October 11, 2007 5:45 AM
  •  Aditon wrote:
    Hi,
    I have many buttons on my form of say size 800 * 600. Now I want to maximize to the current screen resolution. If I just maximize, the contents of the form remain of the same size. I want the buttons and other things to expand according to screen resolution. How do I do this?

     

    You want to automatically resize controls based on screen resolution.

     

    I think the Anchor and Dock Properties can help to achieve the goal.

    Please check this thread and the sample: Working with Anchoring and Docking Properties

    To resize controls dynamically with the form, we can use the Anchor property of Windows Forms controls. The Anchor property describes an anchor position for the control. When a control is anchored to a form and the form is resized, the control maintains the distance between the control and the anchor positions.

     

    Another approach: handle Form_Resize event

    This thread and this document: Automatic Scaling in Windows Forms

     

    In addition, check these threads for reference.

    Resize form when screen resolution changes.

    Screen resolution affects GUI

     

     

    Regards,

    Martin

    Thursday, October 11, 2007 6:14 AM
  • Hey the movie doesn't load. I even tried it for avi. But it doesn't work.

     

    Thursday, October 11, 2007 3:46 PM
  • Hi Aditya,

     

    To play a movie, we must specify the URL property like this:

    AxWindowsMediaPlayer1.URL = "c:\mediafile.wmv"

     

    Here are some actions for you to try:

     

    1. When you add a WindowsMediaPlayer control to form, please remember to resize it in order to show the play area.

     

    2. Imports namespace like this : imports WMPLib

    Adding the Windows Media Player control from the Toolbox also adds references to two libraries created by Visual Studio, AxWMPLib and WMPLib. You can find them in the Solution Explorer under References.

    To make using the objects in the Player namespace easier, you should include the namespace.

     

    3. Let Windows OS show file extensions.

    Tools menu-> Folder Options -> View tab -> Uncheck "Hidden extensions for known file types"

     

    4. Check this KB article to know about file formats supported by Windows Media Player and try these formats.

    http://support.microsoft.com/kb/316992

         Supported file formats
         File formats that are not supported
         How do I determine what type of file I am playing?

     

    5. If they are not helpful, please send your movie file to my mailbox: v-maxie@microsoft.com

     

    Regards,

    Martin

    Friday, October 12, 2007 2:24 AM
  • it worked... thank you.

     

    Aditya

     

    Friday, October 12, 2007 8:20 PM