http://msdn.microsoft.com/library/default.asp?url.../base/registry.asp
http://msdn.microsoft.com/library/default.asp?url...t_the_registry.asp
and from there you'll find
http://msdn.microsoft.com/library/en-us/sysinfo/b...changekeyvalue.asp
Note: Extremely important info can be read on all those pages, read before proceed. It is absolutely mandatory that you understand completely how the registry works (eg: That you understand that registry keys need to be openend before reading or writing, and closed if you're done with it)
A snipped of the important stuff about RegNotifyChangeKeyValue:
- Is not supported on Windows 95
- The key to monitor must first be opened with the KEY_NOTIFY access right.
- The function cannot be used to detect changes to the registry that result from using the RegRestoreKey function.
- After the function has detected a change, it stops working. You need to reinitialize it again if you want to monitor further each time.
- Each time you call the function with the same set of parameters, it establishes another wait operation, creating a resource leak. Therefore, check that you are not calling the function with the same parameters until the previous wait operation has completed.
In other words, this is certainly not basic stuff and you should be very fluent with VB and API's to understand everything.
---------------------------------
Also remember that there are many many places where stuff can be set which will automatically start with Windows. Everybody knows the obvious two:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
But there are extremely many more registry keys which will automatically run when Windows starts. For the most complete list of all of them, see the program
AutoRuns from SysInternals.
---------------------------------
In case you want to write such a program because you want something like that on your computer: there are many (free) programs available on the net which do already what you want. One example (which I use myself) is
StartupMonitor.