views:

31

answers:

1

I would like to implement the following behaviour:

I have a special media player, that is capable to play Internet streams (types of streams is not important, we can consider these are simply media files). A person X has a number of links to such streams, and the person will prepare HTML pages with the links according to my rules.

The goal is: if a user click such link in a browser, then presence of installed my application is checked.

  • If the application is not installed, then the user is prompted to install my application. After the user agrees to install, the application is installed (through remote msi) and is launched with a string as command line parameters.

  • If the application is installed, then it is launched with a string as command line parameters.

I suppose, that one of the way to implement this is to write ActiveX control (that actually is not control, because the ActiveX will not contain UI elements except some messageboxes). The ActiveX will check whether my app is installed, prompt to install the app if necessary; launch installer; launch installed app. The questions are:

  • What another approaches can be applied (besides AciveX)?
  • I did not write AciveX controls. What start points (useful links) you can recommend for writing such ActiveX (taking into account, that it will be coded in MSVC++)?
  • Some another remarks or recommendations?

Thanks in advance.

+1  A: 

Using ActiveX would not be cross-browser compatible, although you could develop plugins for each of the major browser this would still require installation or authorisation by the user. I'm afraid you're going to find this rather difficult unless you're happy to cut one of your requirements (e.g. the first).

To fulfill the second requirement, you should look into registering a custom URL protocol handler. Then you can launch your installed application from a simple link:

<a href="myapp://someCommand/>Click to open with my app!</a> 

For users that don't have your application installed, however, the URL wouldn't work. One workaround for IE (since you mentioned ActiveX) would be to have your application append to the user agent string, then check for the existence of this string with your server-side or client-side code. If it's not there then you know your application is installed.

Andy E
"Using ActiveX would not be cross-browser compatible..." - OK, lets restrict out browsers to IE. Or may be there is better cross-browser solution instead of ActiveX? "To fulfill the second requirement, you should look into registering a custom URL protocol handler..." - Whether it is not allowed to simply call from ActiveX something like CreateProcess or ShellExecuteEx?
VitalyVal
@VitalyVal: You could shell execute with the `WScript.Shell` ActiveX object, but many users are too cautious to allow it to run. The reason I think you should try and steer clear of ActiveX is due to permissions and cross browser compatibility. It's fair enough if you want to restrict to IE, the custom URL protocol handler would be a solution that would work across all browsers anyway, with the added benefit of not requiring a JavaScript based solution. If you have Adobe Reader installed, you can test this out for yourself, just type `acrobat://` into IE's address bar and hit return.
Andy E
Thanks for the answers. Using private protocol seems does not allow to inform a user about a reason, why a link failed to open (in the case of non-installed application). As for user worries on ActiveX actions - it is supposed, that the AciveX will be signed, so this may give to a user more trust to the ActiveX. Generally, it looks like there is no "commonly accepted" approach to my task. Is this right?
VitalyVal
@VitalyVal: You're right, there's no commonly accepted approach. Each to their own, but I often question the need for a site to use an ActiveX control whether signed or not, and I personally ignore that yellow bar when it pops up :-) Adding to the User Agent string as outlined in my post would allow you to detect whether or not the application was installed both at the server and the client, in IE. This would allow you to change the links for links to your download page, so users that don't have your application installed won't be affected by "broken" links.
Andy E
Oh, thanks again. I understood the idea.
VitalyVal