there is my code:
nResult = RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
szSubKey = "software\\pai\\ced\\GEN_LG_NOM_APP_LIGNE";
if ( RegDBKeyExist ( szSubKey ) = 1 ) then
nResult = RegDBDeleteKey ( "software\\pai\\ced\\GEN_LG_NOM_APP_LIGNE" );
endif;
well, I can't get the darn key to be deleted.....funny RegDBKeyExist(szSubKey ) = 1 ) is not true!!! hence the "fail"...
but the Key exist under
HKEY_LOCAL_MACHINE\\software\\pai\\ced\\GEN_LG_NOM_APP_LIGNE
any idea why I con't find it via this fonction????
TIA
Mike
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
RegDBDeleteKey not working???
Started by
mike_vstrom
, Apr 21 2006 19:01
3 replies to this topic
Posted 24 April 2006 - 14:23
Hi Mike,
Hmm, I can't explain why your function isn't returning a 1 when using this function. One idea that comes to mind, is that some other process is removing the key before your code is executed.
I know when I'm doing registry key removals, it is during an uninstall operation. I'm not overly concerned about looking for a key that I want to delete. So, perhaps consider taking a different approach?
Instead of checking for a registry key that you know exists, have some error handling in case the delete fails. For example
Hmm, I can't explain why your function isn't returning a 1 when using this function. One idea that comes to mind, is that some other process is removing the key before your code is executed.
I know when I'm doing registry key removals, it is during an uninstall operation. I'm not overly concerned about looking for a key that I want to delete. So, perhaps consider taking a different approach?
Instead of checking for a registry key that you know exists, have some error handling in case the delete fails. For example
CODE |
nResult = RegDBDeleteKey ( "software\\pai\\ced\\GEN_LG_NOM_APP_LIGNE" ); if(nResult = failure) then MessageBox("Delete Key failed", MB_OK); //other error handling here endif; |
The advantage is the delete key function is being executed, but you still have something in place to deal with failure. I hope this work around helps.
Mike Goldweber
Posted 24 April 2006 - 20:02
Thanks Mike,
but still the same.....
I've tried this before.....I really don't know why...it seems like I don't put the correct key (path) name...
really I am confused......
but still the same.....
I've tried this before.....I really don't know why...it seems like I don't put the correct key (path) name...
really I am confused......
Posted 24 April 2006 - 21:15
Hi again Mike,
Sorry the last idea didn't help. Here's another...
In your example you have
Sorry the last idea didn't help. Here's another...
In your example you have
CODE |
nResult = RegDBDeleteKey ( "software\\pai\\ced\\GEN_LG_NOM_APP_LIGNE" ); |
why not replace this with
CODE |
nResult = RegDBDeleteKey (szSubKey); //szSubKey was the same variable used in your earlier example |
Is there a reason you aren't using that variable twice?
Did you set this key in the DevStudio Registry IDE? Without knowing anything, I am thinking that the auto-remove feature is taking out your key before it gets to your code. Maybe you can double check this? It might be ridiculous, but it couldn't hurt to look.
Mike Goldweber