Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

How To Launch CDs with HTML Applications : Page 2

Use HTML Application (HTA) files to provide an impressive and functional CD launcher for your applications.


advertisement
To create an AutoPlay CD, you include an AUTORUN.INF file in the root directory of the CD in the following format:

[autorun] OPEN=<executable program to run> ICON=<icon to show in Windows Explorer>

If you don't have an icon to display, you can omit the ICON entry. The AutoPlay feature in Windows doesn't call the Win32 ShellExecute() API, so you're limited to .exe, .com or .bat files for the OPEN entry. That's a problem, because you want to launch a .HTA file. Fortunately, the solution is relatively simple—create a short EXE program that calls ShellExecute(). The AUTORUN.EXE program included with the sample calls ShellExecute() for you, so it can launch an HTA file.

The sample AUTORUN.EXE stub program accepts a single command-line argument—the name of the file to run, so if you wanted to the launcher to start an autorun.hta application, your AUTORUN.INF file would look like this:

[autorun] OPEN=autorun.exe autorun.hta

If the ShellExecute() function returns an error (as it would if the target computer doesn't have Internet Explorer 5 or greater), the autorun stub opens the CD root directory in Windows Explorer.

Listing 1 shows the the AUTORUN.EXE source code. You don't need a C compiler to use the sample code unless you want to modify the Autorun.exe program itself.




Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date