|
||
---|---|---|
PowerPoint tips, hints and tutorials that will change your presentations for ever! | ||
Jigsaws |
Saving Settings Let's imagine you have a game or App where the user can manually change certain settings OR change them by reaching a certain level. You would probably store these changed settings in a variable. The problem is they are lost when PowerPoint is closed. How can we save and load them? The best answer is to write to the registry which may sound scary. Don't worry, as long as you use certain fixed keys it's easy and safe. Lets see how we can save the settings for a user. Start by creating Public variables (in most cases module wide variable will do but Public will work if you have other modules and won't cause a problem.
Public strUsername As String And now some typical code to get the username
Sub Get_Name() As the game progresses the value in lng_Level is updated to show the slide reached. When a save game button is clicked we want to save those settings - here's how.
Sub save_Game() These settings will be retained even if the PC is powered down. Next time the game is played get the username again and restore their settings like this:
Sub get_Level() You can easily then use the value to jump to a certain slide in the game. To Delete a User:
Sub delete_Player() If you understand the registry and want to find the keys you create they will be at : HKEY_CURRENT_USER\Software\VB and VBA Program Settings\mygame More than one setting? Create new sub keys like this:
Sub save_Game()
|
|
Articles on your favourite sport Free Microsoft PowerPoint Advice, help and tutorials, Template Links |