The following two FUNCTIONS can be copied and used in your own macros to get information from the registry.
The command to be used in your macro will look something like this:
vResult:=RegistryGetFromCurrentUser ("Software\MyData"; "MyItem")
// ******************************************************************
// Copyright (c) 1999 J. Jeppson. All Rights Reserved.
// http://www.wpmacros.com
// Purpose: Get information from the Registry's CurrentUser section
// Input: vKey: The name of the key to open (i.e., "Software\MySection")
// vItem: The name of the item to get the value for
// Return: Returns the value of the specified item, or 0 if error
// *******************************************************************
FUNCTION RegistryGetFromCurrentUser (vKey; vItem)
HKey:=RegistryOpenKey(CurrentUser!; vKey)
vValue:=RegistryQueryValue(HKey; vItem)
RegistryCloseKey(HKey)
Return(vValue)
ENDFUNC// ******************************************************************
// Copyright (c) 1999 J. Jeppson. All Rights Reserved.
// http://www.wpmacros.com
// Purpose: Get information from the Registry's LocalMachine section
// Input: vKey: The name of the key to open (i.e., "Software\MySection")
// vItem: The name of the item to get the value for
// Return: Returns the value of the specified item, or 0 if error
// *******************************************************************
FUNCTION RegistryGetFromLocalMachine (vKey; vItem)
HKey:=RegistryOpenKey(LocalMachine!; vKey)
vValue:=RegistryQueryValue(HKey; vItem)
RegistryCloseKey(HKey)
Return(vValue)
ENDFUNC
See also: Write Information to the Registry
Terms of Use:
You may include the code displayed here in your own macros with the following conditions:
| The code must be included in its entirety, including copyright and header information. | |
| You may use the code in macros used within your own organization, as part of your job, for your employer, or for your own personal use. | |
| You may modify the code to meet your own needs. | |
| If you modify any code in the routine, you must comment out the original line of code, and leave that original line intact, then type a new line of code with the change that you made. You must then add a comment noting your change. | |
| You may not use the code in macros you create for hire, other than at your regular work for an employer, where the macrowill be used in-house. For example, you may not use this routine in macros you create, modify, or convert for hire as a consultant for a company or individual that you are not a regular employee for. | |
| You may not sell or publish macros that use this routine in any form. | |
| You accept full responsibility for macros that you include this routine in. | |
| J Jeppson will not be obligated to make the code work for you, or for your particular need or usage. | |
| Under no circumstances will J. Jeppson be held liable for any damages or liabilities incurred while using this code. |