AutoPlay Media Studio 9

How do I...?

How do I...?

Previous topic Next topic  

How do I...?

Previous topic Next topic  

AnswerList of Questions

Run my Application Only Once

To run your application only once (i.e. the first time the user inserts your CD-ROM, and no other time), place the following code in the On Startup event of your project:

--retrieve value from the registry. If the key does not exist, result = ""

result = Application.LoadValue("Application_Name", "First_Time");

 

--if there was no key, the program has never been run

if result == "" then

   Application.SaveValue("Application_Name", "First_Time", "yes");

   Dialog.Message("title", "this is the first time this program has run");

else

   Application.Exit();

end

Tip: You can also use Window.Close(Application.GetWndHandle(), CLOSEWND_TERMINATE) in place of Application.Exit().  This will close the window before the window draws itself (i.e. the user will see nothing).


Learn More: Indigo Rose Software - AutoPlay Media Studio - Buy Now - Contact Us