Opening Windows Media Player from my program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MaryKJolly
    New Member
    • Sep 2008
    • 10

    Opening Windows Media Player from my program

    How can Start, Play,Stop and pause Windows Media Player from my VB program
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    you should be able by using its ActiveX, the syntax depends on your VB versión, but using CreateObject would be of help:
    [CODE=VB]
    Dim Obj1 as Object
    Set Obj1=CreateObje ct("WMPlayer.OC X")
    Obj1.visible=tr ue[/CODE]
    You should ask Google about other commands, to open a playlist or stuff like that.

    Comment

    • smartchap
      New Member
      • Dec 2007
      • 236

      #3
      It gives error 'Object doesn't support this property or method' for statement 'obj1.visible = True'

      Comment

      • kadghar
        Recognized Expert Top Contributor
        • Apr 2007
        • 1302

        #4
        hmm, thats perhaps my mistake.

        Once the object has been created as an instance of Windows Media Player. You could only use properties or methods its ActiveX supports.

        If 'visible' is not one of them, the mistake will be shown. Sorry about that. You should ask google about the properties and methods of this application.

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          why not use media player component. you can use all the inbuilt properties and methods.

          Comment

          • smartchap
            New Member
            • Dec 2007
            • 236

            #6
            Thanks for the reply. As a component it will do all the required things, i.e. its properties and methods could be used. Actually I wanted to know how to use as object.

            Comment

            • kadghar
              Recognized Expert Top Contributor
              • Apr 2007
              • 1302

              #7
              Originally posted by smartchap
              Thanks for the reply. As a component it will do all the required things, i.e. its properties and methods could be used. Actually I wanted to know how to use as object.
              The same as a component. For example if you define the object as an InternetExplore r, it has the VISIBLE property and the NAVIGATE method, so you can do this:

              [CODE=vb]dim obj1 as object
              set obj1 = createobject("i nternetexplorer .application")
              obj1.visible=tr ue
              obj1.navigate "www.google.com "[/CODE]

              HTH

              Comment

              Working...