Windows API Guide: Polygon Function


Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long

Platforms: Win 95/98, Win NT

RegDeleteValue deletes a value stored under a specified key in the registry. This function only works with values stored; it cannot delete subkeys. The value can of course be of any registry data type. The function returns 0 if successful, or a non-zero error code if an error occured.

hKey
A handle to the open registry key which contains the value to delete.
lpValueName
The name of the value to delete.

Example:

' Delete the value "SplashScreen" under the hypothetical registry key ' "HKEY_LOCAL_MACHINE\Software\MyProgram\Config".  Note how error conditions are checked. Dim hkey As Long  ' handle to the open registry key Dim retval As Long  ' return value ' First, open up the registry key which holds the value to delete. retval = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\MyProgram\Config", 0, KEY_ALL_ACCESS, hkey) If retval = 0 Then  ' successfully opened registry key   ' Now delete the desired value from the key.   retval = RegDeleteValue(hkey, "SplashScreen")  ' if it existed, it is now deleted   ' Note that we only have to close the registry key if it was successfully opened.   retval = RegCloseKey End If

See Also: RegDeleteKey, RegQueryValueEx, RegSetValueEx
Category: Registry

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/r/regdeletevalue.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net