The whole purpose of the forum is to ask questions. This way we all learn together. Don't worry about asking too many.
Secondly i add pol because u can limitize the days of ur post. that's why i use poll method. Due to this my question will be deleated after 5 days.
Actually, I think the poll is only open for 5 days. The post stays around for eternity. Many people read these posts, so the questions and answers are available to help someone else.
i tried that code; the code was quit difficutl for me because i dont know how u program with "Public" ; i usually use private method to solve my problems.
Private methods (functions and subs) can only be called by other methods in the same class. Public methods can be called from anywhere in your program.
The Windows registry is a hierarchical database. In order to access the registry in VB, it's necessary to call the Windows API. To do this you must first define which Windows library to use (advapi32.dll) and which functions to use (RegCreateKeyExA and RegCloseKey). That's what the
private declare functions do. When Microsoft wrote the library, they defined values that need to be passed to the function for it to work. The constants you see define those values.
After all the smoke has settled, all you need to provide is the key name and the hive name. The hive names are defined in this section of the code:
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
The key name you provide. See the example in the code.
Good luck.
Note: Either take a restore point or create private keys in the
hkey_current_user hive. As you mentioned, the registry may be the brain of the OS, but it has been known to flat line from time to time.