GetStringValue method of the StdRegProv Class
Applies to: desktop apps only
The GetStringValue method returns the data value for a named value whose data type is REG_SZ.
This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.
Syntax
uint32 GetStringValue( [in] uint32 hDefKey = HKEY_LOCAL_MACHINE, string sSubKeyName, string sValueName, string sValue );
Parameters
- hDefKey [in]
-
A registry tree, also known as a hive, that contains the sSubKeyName path. The default value is HKEY_LOCAL_MACHINE.
Be aware thatHKEY_DYN_DATA is a valid tree for computers running Windows 95 and Windows 98 only.
The following trees are defined in Winreg.h.
- HKEY_CLASSES_ROOT (2147483648 (0x80000000))
- HKEY_CURRENT_USER (2147483649 (0x80000001))
- HKEY_LOCAL_MACHINE (2147483650 (0x80000002))
- HKEY_USERS (2147483651 (0x80000003))
- HKEY_CURRENT_CONFIG (2147483653 (0x80000005))
- HKEY_DYN_DATA (2147483654 (0x80000006))
- sSubKeyName
-
[in] A path that contains the named values.
- sValueName
-
[in] A named value whose data value you are retrieving. Specify an empty string to get the default named value.
- sValue
-
[out] A data value for the named value.
Examples
For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository. Other examples are in books and articles listed in Further Information.
For C++ code examples, see WMI C++ Application Examples.
For an example of how to use GetStringValue, see the example in the GetDWORDValue topic.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Namespace |
\root\default |
|
MOF |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 3/9/2012
vbNull is used with the VarType() function to determine the variable *type*, not the variable *value*.
When you compare sValue to vbNull, you compare an empty/non-set variable to the value of the vbNull constant, which equals the number 1
Use
if IsNull(sValue) then sValue = ""
or
if VarType(sValue) = vbNull then sValue = ""
instead
- 4/12/2012
- Magnus Holm
- 4/12/2012
- Magnus Holm