Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reading From An INI File
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00664506
Message ID:
00666973
Views:
25
Ok George, here's another one.

First, I have a constant, REG_TEST_KEY, defined as "Software\RegTest\Test1\Test2"
There are 3 values at that location in the registry:

Test1 This is a test string && REG_SZ
Test2 20 && REG_BINARY
Test3 3 && REG_DWORD


When I run this code, I get back

0 Test1 This is a test stringest string
0 Test2
0 Test3


Notice the 'est string' attached to the end of the string

What am I doing wrong (again)?

My code:
** Program Test
CLEAR

** Include constants
#INCLUDE ApiRef.h

** Define variables
LOCAL lRetVal, iBaseKey, iIndex, sName, iSize

** Register the functions
DECLARE INTEGER RegOpenKey IN Win32API; 
  INTEGER   iKey,; 
  STRING    sSubKey,; 
  INTEGER   @iHandle
	
DECLARE INTEGER RegEnumValue IN advapi32; 
  INTEGER iKey,; 
  INTEGER iIndex,; 
  STRING  @sValueName,; 
  INTEGER @iValueSize,; 
  INTEGER iReserved,; 
  INTEGER @iCode,; 
  STRING  @sData,; 
  INTEGER @iDataSize 
    
** Populate the variables
iHandle		= 0
iIndex		= 0
sValueName	= SPACE(255)
iValueSize	= 255
iReserved	= REG_OPTION_RESERVED
iCode		= 0	
sData		= SPACE(255)	
iDataSize	= 255

** Open the key
=RegOpenKey(HKEY_LOCAL_MACHINE, REG_TEST_KEY, @iHandle)

** Loop once for each value in the test key
FOR iIndex = 0 TO 2

  ** Call the function
  lRetVal = RegEnumValue(iHandle, iIndex, @sValueName, @iValueSize, iReserved, @iCode,  @sData, @iDataSize)

  ** Display the results
  ? lRetVal, STRTRAN(ALLTRIM(sValueName),CHR(0), " " ), STRTRAN(ALLTRIM(sData), CHR(0), "")
	
  ** Reset the buffers
  sValueName	= SPACE(255)
  iValueSize	= 255
  sData		= SPACE(255)	
  iDataSize	= 255

ENDFOR


RETURN
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform