Click here to Skip to main content
15,885,890 members
Articles / Web Development / HTML
Article

Free Autoplay Menu for your CD/DVD Distribution

Rate me:
Please Sign up or sign in to vote.
2.78/5 (16 votes)
18 Mar 2008CPOL3 min read 47.8K   752   22   6
How to create an autoplay menu that runs automatically when the user inserts the CD/DVD
Image 1

Introduction

After you finish building your application, you need to distribute it (on a CD …not floppy disks!!!) then you will need an autoplay menu that runs automatically when the CD is inserted.

The autoplay menu should have the following commands

  1. Install (run setup.exe)
  2. Browse (explore the CD)
  3. Read Me (open the readme file)
  4. Visit our web page (open the company web page)
  5. Exit (closes the autoplay menu)

Background

You could use a third party software which may cost you $400. But why not build your own?

The good news is that this article will show you how to build it easily, just like building an HTML page!!!

C++ or C#/VB.NET or HTML

We cannot use .NET because it may not be installed on the target machine ... then you'll lose before you start!!!

I hear somebody saying C++…… OK that is right, because it runs using only shared DLLs which can be included on the CD.

But how do you customize the autoplay application if you do not know (or like) C++?

Even if you like C++, we still need an easy way to customize the autoplay menu.

I hear somebody saying HTML… yeah… HTML (with animated GIF and JavaScripts……).

To summarize, the sample project included in this article is a template that utilizes C++ for the running code and HTML for the interface.

Using the Code

If You do not like C++

  1. Copy the sample into your solution folder and add it to your solution as an existing project.
  2. Open the file Autoplay.cpp and modify the following lines of code according to your needs

    C++
    //TODO: set those properties according to you needs
    
    m_bShowTitleBar = false;//no title bar
    
    m_bShowMenuBar = false;//no menu bar
    
    m_bLoadFromResources = false;//load from a file in the Data folder
    
     
    
    m_iWidth = 600;//the size
    
    m_iHeight = 450;
    
     
    
    m_strReadMeFileName = "ReadMe.htm";//the readme file
    
    m_strWebPage = "www.OurWebPage.com";//the company web page
  3. Build the HTML page in the data folder the way you like, taking into consideration that:

    • A hyper link with the link to app:install will run setup.exe
    • A hyper link with the link to app:browse will explore the CD
    • A hyper link with the link to app:readme will open the readme file
    • A hyper link with the link to app:webpage will open the company web page
    • A hyper link with the link to app:exit will close the autoplay menu
  4. Build the solution
  5. When distributing, you distribute the autoplay.exe file and the data folder containing the HTML work and the autoplay.ini and the autoplay icon and do not forget the shared MFC DLLs

If You Like C++

You will know how to use it — you will not need my explanation. But I want to point your attention to the fact that you can put (embed) the HTML files into the resources so that they become one part with the executable ... this is the way I like it.

Open Autoplay.rc in the text editor and add the resources for the files you used in the HTML page.

For example:

BK.GIF            HTML             "res\\bk.gif"

And do not forget to add those files in the res folder.

How it Works

It is an SDI with CHtmlView ... with some other easy modifications.

I would like to thank Paul Delaci from MSDN Magazine.

Points of Interest

In the source code you will find small tips like how to remove the title bar and the menu bar for MFC frame windows.

Also, you will find how to prevent IE shortcut keys like F5 and Ctrl+O.

History

March 2008 first release

License

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


Written By
Engineer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralWhy C++ / CHtmlView vs Simple C++ launching an hta Pin
kschlueter220-May-08 10:11
kschlueter220-May-08 10:11 
GeneralRe: Why C++ / CHtmlView vs Simple C++ launching an hta Pin
Hany Badrous20-May-08 10:57
Hany Badrous20-May-08 10:57 
thank u for saying "neat"

i used CHtmlView because we should start at the point other people end.... not from scratch

i am sorry i did not understand the word "hta"

thanks Smile | :)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Hany Badrous
Love programming like playing music

GeneralRe: Why C++ / CHtmlView vs Simple C++ launching an hta Pin
kschlueter219-Jun-08 7:29
kschlueter219-Jun-08 7:29 
GeneralRe: Why C++ / CHtmlView vs Simple C++ launching an hta Pin
Hany Badrous21-Jun-08 17:25
Hany Badrous21-Jun-08 17:25 
GeneralGreat! Pin
TheCardinal18-Mar-08 14:29
TheCardinal18-Mar-08 14:29 
GeneralRe: Great! Pin
Hany Badrous18-Mar-08 17:37
Hany Badrous18-Mar-08 17:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.