473,320 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem in RegistryKeyChangeEvent

Hi,

during Registry key change event ,if i give wrong keypath .it saying invalid query.if i give existing keypath then code is executing correctly ...

my doubt is ,how the event registration is happening in case of Registry key change.
why it saying invalid query in case of wrong input to the keypath.eventhough the keypath should accept a string ..any reference to the same..
Code:
strQuery = " SELECT * FROM RegistryKeyChangeEvent WHERE
KeyPath = 'asdf'"
WqlEventQuery WqlQuery = new WqlEventQuery(strQuery);
watcher = new ManagementEventWatcher(wmiMgmtScope, WqlQuery);
watcher.EventArrived += Eventhandler;
watcher.Start();
Regards,
Sakthi
Sep 17 '08 #1
3 2277
Plater
7,872 Expert 4TB
How can you watch a change on something that doesn't exist? That would not make sense. It sounds like it is functioning correctly.
Sep 17 '08 #2
tlhintoq
3,525 Expert 2GB
How can you watch a change on something that doesn't exist? That would not make sense. It sounds like it is functioning correctly.
Agreed. Can't watch what doesn't exist. Its easy to code for a perfect world. The tough part is to presume everyone is wrong including the input and the state of the machine.

You have to add lots of range checking and presumption validation.

[suedo code]
if (RegKey exists) WatchRegKey
else { messagebox the user they are a dork }

No different than setting up a FileSystemWatcher. If the directory doesn't exist you can't watch it for changes, so either check it exists, or make it before you watch it. If it already exists when you make it, then no harm done.
Sep 18 '08 #3
Plater
7,872 Expert 4TB
You could maybe attempt to watch the parent of where the key *should* be for changes then? The creation of the key in question should register in its parent's change event right?
Sep 18 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
0
by: Refky Wahib | last post by:
Hi I need Technical Support I finished a Great project using .Net and SQL Server and .Net Mobile Control My Business case is to implement this Program to accept about 1 Million concurrent...
9
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.