Announcement

Collapse
No announcement yet.

Running my Application Only Once

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Running 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:
    Code:
    --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 --if there is no value set, the string will be empty
       Application.SaveValue("Application_Name", "First_Time", "yes");
       Dialog.Message("title", "this is the first time this program has run");
    else
        Application.Exit();
    end
    As an alternative you can 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).
Working...
X