Article ID: 190878
Article Last Modified on 3/3/2005
*-- Code begins here.
PARAMETER lsOutput
*-- Defines from Winreg.h
#define KEY_QUERY_VALUE 0x0001
#define HKEY_CURRENT_USER 0x80000001
lnKeyHandle = 0
liValue = 0
lpszValue = SPACE(255)
lpcchValue = 255
lpdwType = SPACE(255)
lpbData=SPACE(255)
lpcbData=255
DECLARE RegOpenKeyEx IN WIN32API INTEGER, STRING, INTEGER, ;
INTEGER, INTEGER @nKeyHandle
DECLARE RegEnumValue IN WIN32API INTEGER lnKeyHandle, INTEGER ;
liValue;
STRING @lpszValue, INTEGER @lpcchValue, INTEGER, STRING @lpdwType, ;
STRING @lpbData, INTEGER @lpcbData
*-- Get a handle for the Visual FoxPro Options key.
lnResult=RegOpenKeyEx(;
HKEY_CURRENT_USER, "Software\Microsoft\VisualFoxPro\6.0\Options", ;
0, KEY_QUERY_VALUE, @LnKeyHandle)
*-- Get a file handle for output file.
IF FILE(lsOutput)
ERASE(lsOutput)
ENDIF
lhFile = FCREATE(lsOutput)
lnReturn = .T.
DO WHILE lnReturn = .T.
*-- Clear the buffers through each loop.
lpszValue = SPACE(255)
lpcchValue = 255
lpdwType = SPACE(255)
lpbData = SPACE(255)
lpcbData = 255
*-- Walk through the values for the key.
lnReturn=RegEnumValue(lnKeyHandle,liValue,@lpszValue,@lpcchValue,0,;
@lpdwType,@lpbData,@lpcbData)
*-- Quit when we start getting empty strings.
IF LEN(ALLTRIM(lpbData)) = 0 AND LEN(ALLTRIM(lpszValue)) = 0
lnReturn = .F.
LOOP
ENDIF
*-- Strip anything after the first null character.
lpszValue = SUBSTR(lpszValue, 1, AT(CHR(0),lpszValue) - 1)
lpbData = SUBSTR(lpbData, 1, AT(CHR(0),lpbData) - 1)
*-- Write it out to the file.
lFresult=FPUTS(lhFile,ALLTRIM(lpszValue) + " " + ALLTRIM(lpbData))
*-- Increment the value index to move to the next value.
liValue = liValue + 1
ENDDO
*-- Close our file handle and open an edit window.
FCLOSE(lhFile)
MODIFY FILE (lsOutput)
*-- Code ends here.130578 How To Customize the Visual FoxPro Environment
Keywords: kbhowto kbregistry kbapi KB190878