Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Deleting CF registry keys

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support
View previous topic :: View next topic  
Author Message
BLFields
Guest





PostPosted: Tue May 02, 2006 3:19 pm    Post subject: Deleting CF registry keys Reply with quote

During testing, the licensing keys tend to accumlate so I wrote a program to find the keys, list the keys in a listView object with check boxes so I could select the ones I wanted to delete. This approach works great for NF, but for CF OpenCF complains that the string I've submitted is not a registry key. I've tried every possible permutation of the registry string (with and without {}, with and without the registry value. This should work but doesn't:

//get the selected key
string strKey = listView1.Items[index].Text;
int length = strKey.LastIndexOf("}");
//remove the braces
strKey = strKey.Substring(0, length+1);
//delete the key
parentKey.DeleteSubKeyTree(strKey);

On the OpenCF forum there is a thread with the same complaint and a suggested change to the OpenCF code. I tried the change but it did not solve the problem.

There is apparently a problem with the OpenCF code when it comes to deleting keys and an exception will always be thrown that the key string submitted is not a registry key. Does anyone know what the problem is?
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue May 02, 2006 10:22 pm    Post subject: Reply with quote

Are you storing your license keys in the registry (by default ILS use a file to store the license key)?

If you are attempting to delete the registry entries made by the EvaluationMonitor then a better way would be to have your program call the EvaluationMonitor.Reset method.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed May 03, 2006 3:20 pm    Post subject: Reply with quote

I don't want to reset the keys, I want to delete them.

I need to test the installation as if the program were being installed on a virgin PDA. I don't want an ILS key present until it is created. So I need a way to delete any and all accumulated keys. Have you tried to delete a registry key using OpenNetCF?
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed May 03, 2006 10:30 pm    Post subject: Reply with quote

EvaluationMonitor.Reset() actually does delete the key and all sub values using RegistryKey.DeleteSubKeyTree(name). I've just checked that this is working correctly under CF.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Thu May 04, 2006 2:43 am    Post subject: Reply with quote

Well, you are exactly right. And the reason my code wasn't working was because it was necessary, apparently, to close the subkey. I note you not only closed it, but set it to null.

It would have been nice if OpenNetCF had issued an error that the key was open or couldn't be deleted instead of claiming that the string wasn't a registry key.

Anyway, I've got it working now. Thanks.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group