• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 563
  • Last Modified:

Value Changed event for the Registry?

Is there a Value Changed event for monitoring Windows XP registry using VB.Net?

There a program outside of my control that is incrementing a counter whose value is stored in the registry. What I'd like to do is know when that value has been changed so I can reset it if it's above a certain value. (kinda like what the FileSystemWatcher class does)

Does anyone know the best way to do this? The counter can get incremented frequently (depending on how often a user clicks or scrolls through a selection of names), so I want to do this as efficiently as possible.

A little example would be great.

Thanks, Jeff
0
JEFFCECCHINI
Asked:
JEFFCECCHINI
  • 2
1 Solution
 
TechTiger007Commented:
I think you should be using "RegNotifyChangeKeyValue" API from advapi.dll
Here is a wrapper around this API in C# you can convert it into vb.net

http://netcode.ru/dotnet/?lang=&katID=30&skatID=277&artID=7638
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Maybe a timer can do the job for you.
It's not a heavy task and you can do that very easily without slowing down the performance.
0
 
JEFFCECCHINIAuthor Commented:
TechTiger007,
I checked it out quickly and that looks what I need to do. Hopefully when I get into it, it'll work for me.

Thanks  jeff
0
 
JEFFCECCHINIAuthor Commented:
Hi jpaulino,

I could take that approach but that really isn't inherintly linked to registry value being changed.

Consequently, the value could get reached before the pre-determined timer fires the check or on the other hand, the timer value could be too short causing a lot of unnessary calls to check the registry value when nothing has changed, that's why responding to an event is best for me.

Thanks though for your idea, as it was valuable. Hopefully TechTiger007's solution will work for me,

Jeff
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now