How would you detect Window Media Player version

How would you detect Window Media Player version

Post by syrthoma » Sun, 13 Mar 2005 23:51:50


I have a Pocket PC application, written in embedded Visual C/C++,
which, amongst other things, launches the Windows Media Player, with an
argument. The argument is the name of the file that the player should
open and play.

I use CreateProcess to launch the player:
CreateProcess(TEXT("\\windows\\wmplayer.exe"), TEXT("\"\\windows\\Unit1
Video.wmv\""), NULL, NULL, FALSE,0, NULL, NULL, NULL, &pi))

There is a space in the filename (in between "Unit1" and "Video.wmv"),
and I cannot avoid that. Actually, the example above is contrived, as
the space is actually in the directory name of the directory on a
Storage Card, but the result is the same.

If I use the above CreateProcess line, on Pocket PCs with WMP 9, the
WMP launches, but doesn't play the file. In fact, it just says
"buffering", and stays stuck there.

On WMP 10, the WMP launches, and the video file begins playing. No
problem.

Now, if I change the CreateProcess line to:
CreateProcess(TEXT("\\windows\\wmplayer.exe"), TEXT("\\windows\\Unit1
Video.wmv"), NULL, NULL, FALSE,0, NULL, NULL, NULL, &pi))

Then, WMP 9 has no problem launching and playing the video file,
whereas WMP 10 comes up with an error message that it cannot play the
file, or file format not supported.

I cannot figure out what to do to get it to work in both versions of
WMP. If I could detect the version of WMP, I can quote or not quote.
I have scanned through the registries of WMP 9 and 10, but could not
find any clsid entry for WMP9 on a Dell Axim, and in a WMP 10, the
version says 1.0?? Any ideas what I could do?

Thanks

Roy Thomas
 
 
 

How would you detect Window Media Player version

Post by Alex Feinm » Mon, 14 Mar 2005 03:07:22

Regardless of the versioning issue, could you try changing file path into
file url: file://windows/unit1%20/video.wmv ?

--
Alex Feinman
---
Visit http://www.yqcomputer.com/

 
 
 

How would you detect Window Media Player version

Post by syrthoma » Mon, 14 Mar 2005 22:05:28

Unfortunately, the %20 is treated as %20 (not a space char). End
result is that wmplayer is not able to find the file.

The behaviour of wmplayer on a Pocket PC, when encountering a %20 on
the command line, is the same as the behaviour of wmplayer on the
desktop. So, in other words, I couldn't get %20 to work, while
experimenting with wmplayer on the desktop (using the "run" command
line).

BTW,on the desktop, both WMP 9 and WMP 10, work fine with quoted
arguments, when there are spaces in the filename. So, it is only on
the Pocket PC, that I see the behaviour of WMP 9 not being able to
handle a quoted argument.

Thanks for your suggestion - any other ideas?

Roy Thomas
 
 
 

How would you detect Window Media Player version

Post by Peter Foot » Mon, 14 Mar 2005 23:14:13

What about using ShellExecuteEx instead of CreateProcess and just call the
full file path and let the system determine the registered application and
launch it.

Peter

--
Peter Foot
Windows Embedded MVP
http://www.yqcomputer.com/ | http://www.yqcomputer.com/
 
 
 

How would you detect Window Media Player version

Post by syrthoma » Tue, 15 Mar 2005 08:27:21

Thank you very much! Your suggestion of using ShellExecuteEx worked
for me. I used the file name :
ShExecInfo.lpFile = TEXT("\\windows\Unit1 Video.wmv");
This worked with both WMP 9 and WMP 10.

Just for the heck of it, I tried:
ShExecInfo.lpFile = TEXT("\"\\windows\Unit1 Video.wmv\"");
and this worked with both WMP 9 and WMP 10, as well.

Thanks to both of you for taking the time to provide suggestions.

Roy Thomas