` Printed Icetips Article

Icetips Article



Windows API: Running Windows Media Player on XP
2005-01-18 -- Jim Kane
 
Newsgroups: comp.lang.clarion,softvelocity.public.clarion6

Editors note:  Please note that there is quite a bit of quoted message text here.  Some of
the text may wrap badly.


Randy:
Please forget about mscomct2.ocx - it has nothing to do with anything.
any code using mediaplayer.mediaplayer will not run on wmp 9 or higher which
would be present on Xp
as your registry entries clearly point out that progid and corresponding
clsid will cause wmpdxm.dll to be loaded on your xp machine.
if you look at wmpdxm.dll in oleview you will see microsoft now has it
marked as private and the interfaces are not the same as earlier versions of
wmp.  Probably the only reason this progid is still there with a dummy dll
is so existing code can load the dll, create the com object, call the
version method and it probably returns something weird like zero.  Since
microsoft expects to you first call the verison property and if the returned
version is not one you coded for you are suppose to exit.  That dll probably
returns 0 or something wierd and different than when that progid was
actually used.

If you want to get wmp to run after installing wmp 9 or higher which is
almost always going to be the case on XP you must use wmplayer.ocx progid
which maps to the ocx i mentioned earlier.
I quickly tried mediaplayer.mediaplayer.1 with the old syntax you previously
posted on XP and it didnt work as I expected.  calling the version method
returned no error but a blank string which should be your clue to exit.

I then looked at the Iwmpplayer4 documentation in msdn and see that
interface has a openplayer() method.  I wrote a quick program to exercise
that putting the file name in the URL format like below and it played the
wav file.   I my quick look I didnt see a version method but I'm sure one of
the related interfaces probably has it and I'd use it the way they have
changed and messed with this interface.
Jim Kane


  program
  map
  end

Window WINDOW('Caption'),AT(,,260,100),GRAY
       OLE,AT(111,32,100,66),USE(?mediacontrol)
       END
     END
szsoundfile   string('D:\jetsons1.wav')
    code
    open(window)
    display()
    accept
      case event()
      of event:openwindow
        ?mediacontrol{prop:create}='wmplayer.ocx'
        ?mediacontrol{prop:reportexception}=true
        ?mediacontrol{'openplayer("FILE:///D:\jetsons1.wav")'}
        message('done')
        post(event:closewindow)
      end
    end
    close(window)


"Randy Rogers"  wrote in message
news:A921.1106019475.7093@discuss.softvelocity.com...
> jim,
> I'm sorry, but I feel thick as a brick.
> I have a clarion 5 program that runs just fine on windows 2k.
> The same program, without change does not work on windows xp.
>
> The only difference is a newer mscomct2.ocx
>
> Have you, or, could you, try using MediaPlayer.MediaPlayer.1 in a clarion
> ole control on windows xp?
>
> In my win2k registry this is what I have:
>
> HKEY_CLASSES_ROOT\CLSID\{22D6F312-B0F6-11D0-94AB-0080C74C7E95}
> C:\WINNT\System32\msdxm.ocx
>
> My Windows XP shows:
>
> HKEY_CLASSES_ROOT\CLSID\{22D6F312-B0F6-11D0-94AB-0080C74C7E95}
> C:\WINDOWS\System32\wmpdxm.dll
>
> Thanks
> Randy
>
> "jim kane"  wrote in message
> news:A921.1106015486.7077@discuss.softvelocity.com...
>> Randy:
>> has nothing to do with clarion versions.
>> on my XP lap top when I search HKey Classes Root for the
>> MediaPlayer.MediaPlayer.1 progid it translates to a
>> clsid of: {22D6F312-B0F6-11D0-94AB-0080C74C7E95}
>> when I look up that clsid  in hkcr\clsid it lists an inprocess32 server
>> of
>> C:\WINDOWS\system32\wmpdxm.dll
>> That dll and not an ocx will be loaded in reponse to the progid you
> mention.
>> for that clsid it also lists a typelibrary of :
>> {22D6F304-B0F6-11D0-94AB-0080C74C7E95}
>> Which is found in msdxm.ocx.
>> According to the type library, the default interface you will get is
>> IMediaPlayer2
>> you can call any method on IMediaPlayer or the IMediaPlayer2 interfaces
>> using that Progid on at least my laptop.
>>
>> so.. mediaPlayer.MediaPlayer.1 has no relation to the mscomct2.ocx.
>> if you use the same progid your code will work in any version of clarion
> the
>> same way.
>> If you change progids you will get back a different interface and need to
>> change your code to match that interface.
>> Jim Kane
>>
>>
>>
>>
>> "Randy Rogers"  wrote in message
>> news:A921.1105972068.6696@discuss.softvelocity.com...
>> > Jim
>> > Thanks for that info.
>> > However, my question is this....
>> > In Clarion5 my application worked fine using the ocx ... why does it
>> > not
>
>> > work the same way when I use MediaPlayer.MediaPlayer.1 for the progid
>> > in
>> > Clarion 6 and updated mscomct2.ocx?
>> > Thanks
>> > Randy
>> > "jim kane"  wrote in message
>> > news:A921.1105929115.6578@discuss.softvelocity.com...
>> >> Randy:
>> >> the progid you are using, wmplayer.ocx.7 translates to a CLSID of
>> >> {6BF52A52-394A-11d3-B153-00C04F79FAA6}
>> >> and the com code is wmp.dll.
>> >> The default interface you will get is IWMPPlayer4.
>> >> You can open wmp.dll in oleview and examine the interface if you want.
> I
>> >> pasted it below as well.  There is probably more documention in msdn
>> >> on
>> > line
>> >> for this interface. Just search for IWMPPlayer4.  If I remember
> correctly
>> > it
>> >> inherits from IWMPCore so you end up having to drill down quite a ways
>> >> but
>> >> all the docs are there.
>> >> jim kane
>> >>
>> >> dispinterface IWMPPlayer4 {
>> >>
>> >> properties:
>> >>
>> >> methods:
>> >>
>> >> [id(0x00000003), helpstring("Closes the media")]
>> >>
>> >> void close();
>> >>
>> >> [id(0x00000001), propget, helpstring("Returns or sets the URL")]
>> >>
>> >> BSTR URL();
>> >>
>> >> [id(0x00000001), propput, helpstring("Returns or sets the URL")]
>> >>
>> >> void URL([in] BSTR rhs);
>> >>
>> >> [id(0x00000002), propget, helpstring("Returns the open state of the
>> >> player")]
>> >>
>> >> WMPOpenState openState();
>> >>
>> >> [id(0x0000000a), propget, helpstring("Returns the play state of the
>> >> player")]
>> >>
>> >> WMPPlayState playState();
>> >>
>> >> [id(0x00000004), propget, helpstring("Returns the control handler")]
>> >>
>> >> IWMPControls* controls();
>> >>
>> >> [id(0x00000005), propget, helpstring("Returns the settings handler")]
>> >>
>> >> IWMPSettings* settings();
>> >>
>> >> [id(0x00000006), propget, helpstring("Returns or sets the current
>> >> media
>> >> object")]
>> >>
>> >> IWMPMedia* currentMedia();
>> >>
>> >> [id(0x00000006), propput, helpstring("Returns or sets the current
>> >> media
>> >> object")]
>> >>
>> >> void currentMedia([in] IWMPMedia* rhs);
>> >>
>> >> [id(0x00000008), propget, helpstring("Returns the media collection
>> >> handler")]
>> >>
>> >> IWMPMediaCollection* mediaCollection();
>> >>
>> >> [id(0x00000009), propget, helpstring("Returns the playlist collection
>> >> handler")]
>> >>
>> >> IWMPPlaylistCollection* playlistCollection();
>> >>
>> >> [id(0x0000000b), propget, helpstring("Returns the version information
> for
>> >> the player")]
>> >>
>> >> BSTR versionInfo();
>> >>
>> >> [id(0x0000000c)]
>> >>
>> >> void launchURL([in] BSTR bstrURL);
>> >>
>> >> [id(0x00000007), propget, helpstring("Returns the network information
>> >> handler")]
>> >>
>> >> IWMPNetwork* network();
>> >>
>> >> [id(0x0000000d), propget, helpstring("Returns/sets the current
>> >> playlist")]
>> >>
>> >> IWMPPlaylist* currentPlaylist();
>> >>
>> >> [id(0x0000000d), propput, helpstring("Returns/sets the current
>> >> playlist")]
>> >>
>> >> void currentPlaylist([in] IWMPPlaylist* rhs);
>> >>
>> >> [id(0x0000000e), propget, helpstring("Get the CDROM drive
>> >> collection")]
>> >>
>> >> IWMPCdromCollection* cdromCollection();
>> >>
>> >> [id(0x0000000f), propget, helpstring("Returns the closed caption
>> > handler")]
>> >>
>> >> IWMPClosedCaption* closedCaption();
>> >>
>> >> [id(0x00000010), propget, helpstring("Returns whether the machine is
>> >> online.")]
>> >>
>> >> VARIANT_BOOL isOnline();
>> >>
>> >> [id(0x00000011), propget, helpstring("Returns the error object")]
>> >>
>> >> IWMPError* Error();
>> >>
>> >> [id(0x00000012), propget, helpstring("Returns status string")]
>> >>
>> >> BSTR status();
>> >>
>> >> [id(0x00000028), propget, helpstring("Returns the DVD handler")]
>> >>
>> >> IWMPDVD* dvd();
>> >>
>> >> [id(0x00000029), helpstring("Creates a new playlist object")]
>> >>
>> >> IWMPPlaylist* newPlaylist(
>> >>
>> >> [in] BSTR bstrName,
>> >>
>> >> [in] BSTR bstrURL);
>> >>
>> >> [id(0x0000002a), helpstring("Creates a new media object")]
>> >>
>> >> IWMPMedia* newMedia([in] BSTR bstrURL);
>> >>
>> >> [id(0x00000013), propget, helpstring("Returns a boolean value
> specifying
>> >> whether or not the control is enabled")]
>> >>
>> >> VARIANT_BOOL enabled();
>> >>
>> >> [id(0x00000013), propput, helpstring("Returns a boolean value
> specifying
>> >> whether or not the control is enabled")]
>> >>
>> >> void enabled([in] VARIANT_BOOL rhs);
>> >>
>> >> [id(0x00000015), propget, helpstring("Returns a boolean value
> specifying
>> >> whether or not the control is in full screen mode")]
>> >>
>> >> VARIANT_BOOL fullScreen();
>> >>
>> >> [id(0x00000015), propput, helpstring("Returns a boolean value
> specifying
>> >> whether or not the control is in full screen mode")]
>> >>
>> >> void fullScreen(VARIANT_BOOL rhs);
>> >>
>> >> [id(0x00000016), propget, helpstring("Returns a boolean value
> specifying
>> >> whether or not the context menu is enabled on the control")]
>> >>
>> >> VARIANT_BOOL enableContextMenu();
>> >>
>> >> [id(0x00000016), propput, helpstring("Returns a boolean value
> specifying
>> >> whether or not the context menu is enabled on the control")]
>> >>
>> >> void enableContextMenu(VARIANT_BOOL rhs);
>> >>
>> >> [id(0x00000017), propput, helpstring("Specifies the ui mode to
> select")]
>> >>
>> >> void uiMode([in] BSTR rhs);
>> >>
>> >> [id(0x00000017), propget, helpstring("Specifies the ui mode to
> select")]
>> >>
>> >> BSTR uiMode();
>> >>
>> >> [id(0x00000018), propget, helpstring("Returns a boolean value
> specifying
>> >> whether or not video is stretched")]
>> >>
>> >> VARIANT_BOOL stretchToFit();
>> >>
>> >> [id(0x00000018), propput, helpstring("Returns a boolean value
> specifying
>> >> whether or not video is stretched")]
>> >>
>> >> void stretchToFit([in] VARIANT_BOOL rhs);
>> >>
>> >> [id(0x00000019), propget, helpstring("Returns a boolean value
> specifying
>> >> whether or not video is windowless")]
>> >>
>> >> VARIANT_BOOL windowlessVideo();
>> >>
>> >> [id(0x00000019), propput, helpstring("Returns a boolean value
> specifying
>> >> whether or not video is windowless")]
>> >>
>> >> void windowlessVideo([in] VARIANT_BOOL rhs);
>> >>
>> >> [id(0x0000001a), propget, helpstring("Indicates whether the player is
>> >> running remotely")]
>> >>
>> >> VARIANT_BOOL isRemote();
>> >>
>> >> [id(0x0000001b), propget, helpstring("Returns the player application
>> >> handler")]
>> >>
>> >> IWMPPlayerApplication* playerApplication();
>> >>
>> >> [id(0x0000001c), helpstring("Opens the player with the specified
>> >> URL")]
>> >>
>> >> void openPlayer([in] BSTR bstrURL);
>> >>
>> >> };
>> >>
>> >> "Randy Rogers"  wrote in message
>> >> news:A921.1105718081.5819@discuss.softvelocity.com...
>> >> >I have an old application that I am converting to clarion 6.1
>> >> > This app used to work fine but it does not in clarion 6.1
>> >> >
>> >> > This is what my old code looked like.
>> >> >
>> >> >
>> >
> OLE,AT(4,1),USE(?MediaControl),TRN,CREATE('MeadiaPlayer.MediaPlayre.1'),COMP
>> >> > ATIBILITY(020H)
>> >> >
>> >> >  ?MediaControl{'ShowControls'} = bShowControls
>> >> >  ?MediaControl{'ShowPositionControls'} = FALSE
>> >> >  ?MediaControl{'ShowTracker'} = FALSE
>> >> >  ?MediaControl{'Filename'} = szSoundFile
>> >> >
>> >> > I am running XP SP1 and when I select the WindowsMediaPlayer OCX
>> >> > control
>> > I
>> >> > get...
>> >> >
>> >> >
>> >
> OLE,AT(4,1),USE(?MediaControl),TRN,CREATE('WMPlayer.OCX.7'),COMPATIBILITY(02
>> >> > 0H)
>> >> >
>> >> > This does not appear to have the same properties.
>> >> >
>> >> > Has anyone been able to get the newer media player to work in an ocx
>> >> > control?  If so, can you shed a bit of light on my issue?



Printed May 7, 2024, 12:25 am
This article has been viewed/printed 35131 times.
Google search has resulted in 1720 hits on this article since January 25, 2004.