Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

deleting SetRegistryKey

84 views
Skip to first unread message

Larry Waibel

unread,
Aug 12, 1997, 3:00:00 AM8/12/97
to

How do I delete the entire key/subvalues that gets setup by the
MFC SetRegistryKey and used by the SetProfile... calls, for both Win95 and
WinNT? I can't seem to find an MFC wrapper that gives access to it. Thanks!

Using Virtual Access
4.00 build 213a (32-bit) WinNT build 1381
http://www.ashmount.com/va

Jim Marshall

unread,
Aug 13, 1997, 3:00:00 AM8/13/97
to

There isn't a wrapper to delete the whole key created by SetRegistryKey.
You can use the RegDeleteKey API call. You can use one of the global
keys (i.e. HKEY_CURRENT_USER) or you could use the _UNDOCUMENTED_
(meaning MS doesn't warranty these functions will be available in later
releases, or will work the same) CWinApp::GetAppRegistryKey or
CWinApp::GetSectionKey (you are responsible for calling RegCloseKey on
the hkey returned by these functions).

In addition (and this is also undocumented) if you call
WriteProfileString so that the second and third parameter are NULL, the
MFC code will delete all subkeys, i.e.

SetRegistryKey("MyCorp");
WriteProfileString("MyApp", NULL, NULL);

This will delete all subkeys of the
HKEY_CURRENT_USER\Software\MyCorp\MyApp registry entry

Hope that helps
--
Author for Visual C++ Devloper http://www.pinpub.com/vcd/
---
Talk is cheap & lies are expensive....
My wallets fat & so is my head.
---

Larry Waibel

unread,
Aug 14, 1997, 3:00:00 AM8/14/97
to

In article <33F275...@msn.com>, Jim Marshall wrote:
> In addition (and this is also undocumented) if you call
> WriteProfileString so that the second and third parameter are NULL, the
> MFC code will delete all subkeys, i.e.

Will this work in both Win95 and WinNT? If so, I might be willing to risk
using an 'undocumented' call in this case. Thanks!

0 new messages