| Registry |
from Spatial Solutions Inc.
available through www.spatial-online.com | |
| ...query or modify the registry from ArcView | ||
Registry provides a means for ArcView developers to access the Registry. It comes with a dll which the script assumes is placed in the \bin32 subdirectory under the ArcView installation, most likely c:\Esri\Av_gis30\Arcview\bin32. A sample ArcView script will be loaded into the system scripts when Registry is installed and help will be available through Help > Registry when a script is open.
WARNING !! Modifying values in the Registry can be dangerous. Many programs assume the values to be appropriately set and will not run if they are modified. Please use with caution.
Return to Table of Contents
Registry, amongst other ArcView extensions, can be downloaded and
installed for a free trial from
www.spatial-online.com. The file that is
downloaded is called Registry.exe. Double click on the file, and
an Install Wizard will guide you through the installation.
After installation,
the extension will be available through the usual ArcView extension directory.
To load the extension,
Return to Table of Contents
The Registry dll provides 4 functions for accessing the registry:
To evoke any of these functions, you must define the dll and the function. The following Avenue code achieves this:
Return to Table of Contents
Return to Table of Contents
Spatial Solutions Inc. offers four products for the cleaning and building of
polygons.
This help is provided from within ArcView by the assistance of a free utility
called EvokeBrowser. This product enables
one to evoke the default browser from within Avenue code.
Click here to download the free
utility EvokeBrowser.
While modifying the registry is dangerous, it is also sometimes necessary.
SSI provides a free utility to access the registry from within Avenue.
Click here to download the free
utility Registry.
Return to Table of Contents
The software comes "as is".
Neither Spatial Solutions Inc. or www.spatial-online.com make any
warranty, representation, promise or guarantee of any kind, either expressed
or implied, statutory or otherwise, including, but not limited to the implied
warranties of quality, performance, non-infringement, merchantability and
fitness for a particular purpose. The entire risk as to the quality and
performance of the software is with the user. We do not warrant that the
functions contained in the software will meet your requirements or that
the operation of the software will be uninterrupted or error free.
Installation Instructions
After the extension is loaded, when the Script Menu is visible, there will be
an Registry option under Help. It will bring up this help screen. It utilizes
EvokeBrowser to evoke the standard browser with
Registry.htm.
Use in ArcView
Each function returns an error code.
The parameters are:
If the data type cannot be found REG_SZ is assumed.
REG_BINARY Binary data in any form. REG_DWORD A 32-bit number. REG_DWORD_LITTLE_ENDIAN A 32-bit number in little-endian format. This is equivalent to REG_DWORD.
In little-endian format, a multi-byte value is stored in memory from the lowest byte (the "little end") to the highest byte. For example, the value 0x12345678 is stored as (0x78 0x56 0x34 0x12) in little-endian format.
Windows NT, Windows 95, and Windows 98 are designed to run on little-endian computer architectures. A user may connect to computers that have big-endian architectures, such as some UNIX systems. REG_DWORD_BIG_ENDIAN A 32-bit number in big-endian format.
In big-endian format, a multi-byte value is stored in memory from the highest byte (the "big end") to the lowest byte. For example, the value 0x12345678 is stored as (0x12 0x34 0x56 0x78) in big-endian format.REG_EXPAND_SZ A null-terminated string that contains unexpanded references to environment variables (for example, "%PATH%"). It will be a Unicode or ANSI string depending on whether you use the Unicode or ANSI functions. REG_LINK A Unicode symbolic link. REG_MULTI_SZ An array of null-terminated strings, terminated by two null characters. REG_NONE No defined value type. REG_RESOURCE_LIST A device-driver resource list. REG_SZ A null-terminated string. It will be a Unicode or ANSI string depending on whether you use the Unicode or ANSI functions.
dllName = system.GetEnvVar( "AVHOME")+"\Bin32\" + "Registry.dll"
dllReg = DLL.Make(dllName.AsFileName)
if (dllReg = nil) then
msgbox.error( "Could not load Registry.dll","Registry")
return 0
end
GetKey = DLLProc.Make(dllReg,"GetKey",#DLLPROC_TYPE_INT32,{#DLLPROC_TYPE_STR, #DLLPROC_TYPE_STR, #DLLPROC_TYPE_STR, #DLLPROC_TYPE_STR, #DLLPROC_TYPE_PINT32, #DLLPROC_TYPE_STR})
if (GetKey = nil) then
msgbox.error( "Could not make GetKey", "Registry")
return 0
end
PutKey = DLLProc.Make(dllReg,"PutKey",#DLLPROC_TYPE_INT32,{#DLLPROC_TYPE_STR, #DLLPROC_TYPE_STR, #DLLPROC_TYPE_STR, #DLLPROC_TYPE_STR, #DLLPROC_TYPE_INT32, #DLLPROC_TYPE_STR})
if (PutKey = nil) then
msgbox.error( "Could not make PutKey", "Registry")
return 0
end
DeleteValue = DLLProc.Make(dllReg,"DeleteValue",#DLLPROC_TYPE_INT32,{#DLLPROC_TYPE_STR, #DLLPROC_TYPE_STR, #DLLPROC_TYPE_STR})
if (DeleteValue = nil) then
msgbox.error( "Could not make DeleteValue", "Registry")
return 0
end
DeleteKey = DLLProc.Make(dllReg,"DeleteKey",#DLLPROC_TYPE_INT32,{#DLLPROC_TYPE_STR, #DLLPROC_TYPE_STR})
if (DeleteKey = nil) then
msgbox.error( "Could not make DeleteKey", "Registry")
return 0
end
The functions are then evoked using the DLLProc Call. Examples of calls are:
strData = String.MakeBuffer(1000)
nData = strData.Count
strType = String.MakeBuffer(24)
nReturn = GetKey.Call({"HKEY_LOCAL_MACHINE", "SOFTWARE\SpatialOnline\Registry", "Path", strType, nData, strData})
if (nReturn = 0) then
msgBox.info("The path of the Registry help is " + strData, "Registry")
else
msgBox.info("The path could not be retreived. It returned error code " + nReturn.AsNumber, "Registry")
end
strData = "New Data"
nReturn = PutKey.Call({"HKEY_LOCAL_MACHINE", "SOFTWARE\SpatialOnline\Registry\NewKey", "NewData", "REG_SZ", strData.Count, strData})
if (nReturn = 0) then
msgBox.info("A new key and new value are added","Registry")
else
msgBox.info("The new value could not be added. It returned error code " + nReturn.AsNumber, "Registry")
end
nReturn = DeleteValue.Call({"HKEY_LOCAL_MACHINE", "SOFTWARE\SpatialOnline\Registry\NewKey", "NewData"})
if (nReturn = 0) then
msgBox.info("The new value is deleted","Registry")
else
msgBox.info("The new value could not be deleted. It returned error code " + nReturn.AsNumber, "Registry")
end
nReturn = DeleteKey.Call({"HKEY_LOCAL_MACHINE", "SOFTWARE\SpatialOnline\Registry\NewKey", "NewData"})
if (nReturn = 0) then
msgBox.info("The new key is deleted","Registry")
else
msgBox.info("The new key could not be deleted. It returned error code " + nReturn.AsNumber, "Registry")
end
There is also a sample script included with the extension. To include the code within your script, when the script is
active, click Script > Load System Script. Scroll down to Registry.Sample and highlight it. Click OK.
Frequently Asked Questions
Many Windows processes utilize the registry to store a lot of
information critical to the efficient running of your computer. Modifying these values could render your computer
inoperable.
The registry can be used to store information between activities,
even if the computer is shut down. For instance, if the user has the ability to install a program in a folder of
their choice, it is useful to store the name of that folder in the registry so that it can be found by other programs
later.
Other SSI Products
About Registry