Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Not having a system readily available to test this on, what happens if I create an app that uses "wmp.dll", but wmp.dll is not on the system? (Like the "N" versions of Windows)?

My app uses an embedded Media Player for video preview. Can easily I catch the error, or "pre-detect" the non-existence of WMP, and redirect the flow to a form which uses the VideoLan player instead?

Where would the error pop up? Just when the preview form is called, or will it detect it right from the start of the app because of the references to WMPLib and AxWMPLib?

(Not that it probably matters, but this is in C# targetting Win7)

Later...
Would putting the two varieties of Preview forms in separate DLLs, called as appropriate, be a better idea?

And, if so, how the %^$#%! do I get it to work? I tried it and a "form" pops up, but it bears no resemblance to anything to the form I designed, being completely blank.
Posted
Updated 30-Oct-10 12:57pm
v2

1 solution

Depending on how a DLL is accessed, you may get an error on startup or you may get an error on the first attempt to access it. In your case, you seem to be using COM interop via C#, so you'll most likely not get an error per se, although you'll obviously not see the ActiveX control in your UI. One way to work around this is to try and detect if wmp is present on startup (should be possible by examining the registry) and if it's not present, then show an error message and quit.

Hint: try opening and going through this key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MediaPlayer
 
Share this answer
 
Comments
GenJerDan 30-Oct-10 23:25pm    
But I don't want it to be an error, per se. I'd rather give the user a choice between using WMP, if available, or a VideoLan (which I'll include with the app), if not.

Looking in the registry for WMP will work, I guess. Don't need special permissions just to look, hopefully. :)
Meanwhile, Googling brought up a mention of "Managed Extensibility Framework", which is overly complicated for my purposes, but interesting...maybe in version 2.

As for not seeing the ActiveX...I wasn't seeing a ListBox, either, so something about the way I'm calling the form in the DLL is just plain wrong...and I can find no samples of how to do it. No samples that work, anyway. :(
GenJerDan 31-Oct-10 15:00pm    
And, just in case anyone is interested, the app won't blow up if "using" the WMP control if it doesn't exist on the box. It just ignores it the reference. Had to put in VMWare and an N version of Windows to find out, but there it is.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900