Monitor Changes to the Registry

Category:
Registry
Type:
Snippets
Difficulty:
Intermediate
Author:
Arkadiy Olovyannikov

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This function allows you to monitor changes in Registry keys and subkeys. It may be useful to protect your Registry (especially "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" or "RunOnce") against "non-friendly" applications.

Note that your application will freeze while monitoring, unless and until a registry change within the monitored keys occurs. Thus, you would probably use this code in a non-UI based application.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: