Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

winqueryreg

Item from Windows registry

Syntax

valnames = winqueryreg('name',rootkey,subkey)
value = winqueryreg(rootkey,subkey,valname)
value = winqueryreg(rootkey,subkey)

Description

example

valnames = winqueryreg('name',rootkey,subkey) returns all value names in rootkey\subkey of Microsoft® Windows® operating system registry. The first argument is the literal, quoted, case-sensitive character vector 'name'.

example

value = winqueryreg(rootkey,subkey,valname)returns the value for valname in rootkey\subkey.

value = winqueryreg(rootkey,subkey)returns a value in rootkey\subkey that has no value name property.

Examples

collapse all

Display Control Panel\Mouse values.

Get a list in variable mousechar for registry subkey Mouse, which is under subkey Control Panel, which is under root key HKEY_CURRENT_USER.

mousechar = winqueryreg('name','HKEY_CURRENT_USER','control panel\mouse');

For each name in the mousechar list, get its value from the registry and then display the name and its value:

for k = 1:length(mousechar)
   setting = winqueryreg('HKEY_CURRENT_USER','control panel\mouse',mousechar{k});
   str = sprintf('%s = %s',mousechar{k},num2str(setting));
   disp(str)
end
mousechar = 
    'ActiveWindowTracking'
    'Beep'
    'DoubleClickHeight'
    'DoubleClickSpeed'
    'DoubleClickWidth'
    'ExtendedSounds'
    'MouseHoverHeight'
    'MouseHoverTime'
    'MouseHoverWidth'
    'MouseSensitivity'
    'MouseSpeed'
    'MouseThreshold1'
    'MouseThreshold2'
    'MouseTrails'
    'SmoothMouseXCurve'
    'SmoothMouseYCurve'
    'SnapToDefaultButton'
    'SwapMouseButtons'

Display the CLSID for mwsampctrl.2, a sample Microsoft COM control used in MATLAB® examples.

winqueryreg('HKEY_CLASSES_ROOT','mwsamp.mwsampctrl.2\clsid')
ans =
   {5771A80A-2294-4CAC-A75B-157DCDDD3653}

Input Arguments

collapse all

Root key name, specified as a case-sensitive character vector.

Example: 'HKEY_CLASSES_ROOT'

Subkey name, specified as a character vector. The value is not case-sensitive.

Example: 'control panel\mouse'

Name of value, specified as a character vector. The name is not case-sensitive.

Output Arguments

collapse all

Value names, specified as a cell array of character vectors.

Value of specified name, specified as a character vector if the value retrieved from the registry is a string. If the value is a 32-bit integer, winqueryreg returns the value as an integer of the MATLAB type int32.

Limitations

  • This function works for the following registry value types only:

    • strings (REG_SZ)

    • expanded strings (REG_EXPAND_SZ)

    • 32-bit integer (REG_DWORD)

Introduced before R2006a

Was this topic helpful?