SpriteHand
Module Border
  Silverlight for Interactive CD/DVD
Module Border
Location: BlogsAndy's Blog    
Posted by: host 1/11/2009 9:29 PM

Back in the day before broadband internet access, it was quite common to distribute Flash applications on CD or DVD along with large video files and interactive content. This was the only practical way for users to view video because internet connection speeds were too slow for streaming video.

But even today, there is still a demand for Interactive content on CD – a couple of examples that come to mind are educational software and media distributed at conferences and trade shows. Silverlight is an attractive option for interactive media, because of its quick adoption rate and small runtime install. So what if we wanted to use Silverlight as a solution for an Interactive CD?

There are a few ways we could go about this, including using a Stand-Alone Silverlight solution such as Desklighter. Or, we could use an HTML Application (HTA) – which is the approach I took for a recent project. An HTA is really just an HTML file, renamed to have an .HTA extension, and with optional embedded tags to control things such as Window Title, Menus, and Icon. Oh, and an HTA is a trusted application, so it can get access to the client operating system unlike a normal HTML page in a browser.

[DOWNLOAD SAMPLE CODE]

THE INGREDIENTS

1.       A Silverlight Application, compiled to a XAP.

2.       An HTML test page pointing to the Silverlight XAP (the testpage HTML file generated by Silverlight Tools for Visual Studio will work fine). Rename this file’s extension to .HTA so that it can be launched as an HTML Application (after renaming the file you can test launch it by double-clicking the HTA file). You can also add optional HTA attributes inside the section of your HTML to control things such as Window appearance and menus. An example Application tag is shown below, and you can find all of the HTA attributes here.

BORDER="Thin"
CAPTION="yes"
APPLICATIONNAME="Hello Silverlight DVD"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SINGLEINSTANCE="yes"
SHOWINTASKBAR="yes"
SYSMENU="yes"
SCROLL="no"
SELECTION="no"
WINDOWSTATE="normal"/>

3.       An autorun.inf file.  This will allow us to “AutoPlay” the Silverlight application on CD or DVD. Autorun.inf is a simple text file with an [autorun] section containing the name of an Executable file to launch and an optional icon file to show:

[autorun]
OPEN=ShellExecuteWin.exe
ICON=setup.ico

* The important thing to note here is that the Autorun OPEN setting MUST point to an EXE file. We cannot point directly to our HTA file for launching.

4.       A small executable file to launch the HTA application (see note above). Since we want to keep our runtime requirements to a minimum, a wise choice for this little “bootstrap” EXE is Visual C++.  We can use Visual Studio 2008 to create a Win32 Project and add a call to ShellExecute, which allows us to launch another application:

ShellExecute(NULL,_T("open"),_T("AutoRunTestPage.hta"),_T(""),_T(""), 0 );

NOTE that the sample download includes the Visual C++ Project to save you some grief. But if you need to create your own VC++ launcher, remember these notes:

a.       You need to add includes to windows.h and shellapi.h

b.      In order to avoid dependencies on runtime DLLs which may not be present on a client’s system, you want to statically link. To do this, select Project Properties and select C/C++ and then Code Generation and make sure to select Runtime Library= Multithreaded (/MT)

THE SAMPLE DOWNLOAD

The download ZIP contains a sample implementation of a Silverlight HTA application with Autorun for CD/DVD. If you look in the DistributionFiles directory, you will see these files:

1.       AutoRunSilverlight.xap is our Silverlight Application

2.       AutoRunTestPage.hta is our HTML Application, containing the Silverlight App Reference

3.       Autorun.inf is our Autorun configuration file

4.       ShellExecuteWin.exe is our EXE launcher, created in C++ and using ShellExecute to launch the HTA

To complete the CD, you just need to burn these files onto the root folder of a disk. When a user inserts the disk, their experience will vary depending on their Autoplay settings in Control Panel.

Permalink |  Trackback

Comments (8)   Add Comment
Re: Silverlight for Interactive CD/DVD    By Anonymous on 1/13/2009 3:28 AM
SWEET!!!

Thanks.

Re: Silverlight for Interactive CD/DVD    By Anonymous on 1/14/2009 12:51 AM
...or you could write a WPF app, and have much more functionality than Silverlight gives anyway. Though I guess the advantage with Silverlight is that you could probably hack together a way to make it work on Mac as well.

Re: Silverlight for Interactive CD/DVD    By Anonymous on 1/14/2009 8:12 AM
Another advantage of Silverlight over WPF is the smaller runtime/install requirement.

Re: Silverlight for Interactive CD/DVD    By Anonymous on 2/5/2009 5:09 AM
And you can reuse your stuff online!
www.maximago.de

Silverlight for Interactive CD/DVD    By TrackBack on 2/9/2009 2:48 PM
Thank you for submitting this cool story - Trackback from DotNetShoutout
# DotNetShoutout

Re: Silverlight for Interactive CD/DVD    By Anonymous on 4/27/2009 1:36 PM
How is the Silverlight runtime itself installed in this scenario?

Re: Silverlight for Interactive CD/DVD    By Anonymous on 5/22/2009 6:23 PM
hey - I am looking to do something similar. I've got a SL app running through a browser with DB hooks and connectivity, but my client doesn't have SL and HAS NO ADMIN RIGHTS to install SL plugin...so I am stuck with this sweet app. that can't be viewed.

Solution: can i disable the DB hooks and compile this software to a DVD with autorun...and have my client run this locally, without having to install anything? kinda like what Flash can do...

HELP!!

Thanks,
Carolina

Re: Silverlight for Interactive CD/DVD    By Anonymous on 5/22/2009 6:23 PM
hey - I am looking to do something similar. I've got a SL app running through a browser with DB hooks and connectivity, but my client doesn't have SL and HAS NO ADMIN RIGHTS to install SL plugin...so I am stuck with this sweet app. that can't be viewed.

Solution: can i disable the DB hooks and compile this software to a DVD with autorun...and have my client run this locally, without having to install anything? kinda like what Flash can do...

HELP!!

Thanks,
Carolina


Title:
Comment:
Add Comment   Cancel 
Module Border Module Border
Module Border
  Subscribe
Module Border

RSS

Module Border Module Border
Module Border
  Diversions
Module Border

BOSS LAUNCH
This physics game won first place in the Server Quest Contest. Created using Silverlight 2, the Physics Helper Library,  and the Farseer Physics Engine.
PLAY IT

MORE INFO



DESTROY ALL INVADERS
A scrolling shooter game where the objective is to destroy the invading UFO's flying over a neighborhood of your choosing. Imagery provided by Microsoft Virtual Earth. Created using Silverlight 2.
PLAY IT

INFO AND CODE



PHYSICS HELPER DEMOS
These demos were created for the Physics Helper Library, which makes it easy to create physics games and simulations using Expression Blend, Silverlight, and the Farseer Physics Engine.
PLAY IT

INFO AND CODE



HOOK SHOT
This little basketball game took first place in the TeamZoneSports Silverlight Contest. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



SORT THE FOOBARS
A game where you need to sort the good foobars from the bad ones. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



POLYGON PHYSICS DEMO
A demo showing polygon physics where the user draws physics objects with the mouse. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



SILVERLIGHT ROCKS!
Destroy the asteroids before they destroy your ship! Created using Silverlight 2.
PLAY IT

INFO AND CODE



FISH GAME
A simple game of harpoon-the-fish. Written using the AJAX Sprite Toolkit.
PLAY IT

INFO AND CODE

Module Border Module Border
Module Border
  Search_Blog
Module Border
Module Border Module Border
Module Border
  Blog_Archive
Module Border
Module Border Module Border
Copyright (c) 2010 andy.beaulieu.com - Login