Run my Application Only Once (Uygulamamı Sadece Bir Kere Çalıştır)

guclusat

Tanınmış Üye
Süper Moderatör
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:

Kod:
--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).
 
Yukarı