| MATLAB Function Reference | ![]() |
Get item from Microsoft Windows registry
Syntax
value = winqueryreg('name', 'rootkey', 'subkey')
value = winqueryreg('rootkey', 'subkey', 'valname')
value = winqueryreg('rootkey', 'subkey')
Description
value = winqueryreg(' returns the key names in name', 'rootkey', 'subkey')
rootkey\subkey in a cell array of strings. The first argument is the literal quoted string, 'name'.
If the value retrieved from the registry is a string, winqueryreg returns a string. If the value is a 32-bit integer, winqueryreg returns the value as an integer of MATLAB type int32.
value = winqueryreg('rootkey', 'subkey', 'valname')
returns the value for key valname in rootkey\subkey.
value = winqueryreg('rootkey', 'subkey')
returns a value in rootkey\subkey that has no value name property.
Note
The literal name argument and the rootkey argument are case-sensitive. The subkey and valname arguments are not.
|
Remarks
This function works only for the following registry value types:
Example 1
Get the value of CLSID for the MATLAB sample COM control mwsampctrl.2:
winqueryreg 'HKEY_CLASSES_ROOT' 'mwsamp.mwsampctrl.2\clsid' ans = {5771A80A-2294-4CAC-A75B-157DCDDD3653}
Example 2
Get a list in variable mousechar for registry subkey Mouse, which is under subkey Control Panel, which is under root key HKEY_CURRENT_USER.
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 ActiveWindowTracking = 0 DoubleClickHeight = 4 DoubleClickSpeed = 830 DoubleClickWidth = 4 MouseSpeed = 1 MouseThreshold1 = 6 MouseThreshold2 = 10 SnapToDefaultButton = 0 SwapMouseButtons = 0
| winopen | wk1finfo | ![]() |
© 1994-2005 The MathWorks, Inc.