Hi,
I've written a script (see below) that monitors the registry for changes
using the "RegNotifyChangeKeyValue" method from the "TieRegistry"
module. It works in blocking mode, where it waits indefinitely for a
change, but won't work in asynchronous mode, where the method should
signal an event when a change occurs. The problem is the event never
gets signaled.
Does anyone have any clues as to how to resolve the problem.
thanks...
John Huber
# Begin Script
use strict;
use Win32::Event;
use Win32::TieRegistry qw(:REG_);
$Registry->Delimiter("/");
my $legalNoticeKey = $Registry->{
"HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/policies/s
ystem/"}
or die "Can't watch for changes: $^E\n";
# Create an "Event" that requires manual resetting
my $hEvent = Win32::Event->new(1,0,"myEvent");
# Start "RegNotifyChangeKeyValue" in non-blocking mode (async)
$legalNoticeKey->RegNotifyChangeKeyValue(1, REG_NOTIFY_CHANGE_LAST_SET,
$hEvent, 1);
print "Setup RegNotifyChangeKeyValue\n";
while (1) {
my $status = $hEvent->wait(0);
print "Status [$status]\n";
last if ($status == 1);
sleep 5;
}
print "The Registry was changed\n";
__END__
___________________________________________________________________________________________________________
This email and any attachments thereto may contain private, confidential, and
privileged material for the
sole use of the intended recipient. Any review, copying, or distribution of this email
(or any attachments
thereto) by other than the County of Sacramento or the intended recipient is strictly
prohibited.
If you are not the intended recipient, please contact the sender immediately and
permanently
delete the original and any copies of this email and any attachments thereto.
___________________________________________________________________________________________________________
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs