Article ID: 140170 - Last Review: July 1, 2004 - Revision: 2.2 How To Read from the Windows RegistryThis article was previously published under Q140170 On This PageSUMMARY
You can use the Windows API functions RegEnumValue() and RegOpenKey() to
read values into a Visual FoxPro application from a multiple-valued key in
the Windows registry. For single-valued registry keys (not covered in this
article) use the RegQueryValue() API.
More information about API functions in general can be found in the Win32api.hlp help file that comes with the Professional version of Visual FoxPro. Also, for information on how to write to the Windows registry, please see the following article in the Microsoft Knowledge Base: 135398
(http://support.microsoft.com/kb/135398/EN-US/
)
How To Write to the Windows Registry Using API Calls
NOTE: Reading from the Windows registry applies to the Windows NT and
Windows 95 operating systems. Use GetProfileString and WriteProfileString
to read and write to the appropriate .ini files in the Windows for
Workgroups and Windows 3.1 operating systems.
MORE INFORMATIONGeneral Procedure for Reading Values from the Registry
Sample CodeNOTE: In some cases the Registry will not have all the settings for Visual FoxPro. Before running this code example, run REGEDIT for Windows 95 and make sure that the TMPFILES entry is there. If it is not there, this code example will go into an endless loop. On the Tools menu, click Options, and then click Set as Default. This will force the entries into the registry.The following code reads the setting for the TMPFILES value from the Software\Microsoft\VisualFoxPro\3.0\Options\TMPFILES key in the Windows registry.
| Article Translations
|
Back to the top
