Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
QueryRegValue Woes... Please help.
Message
From
20/01/1999 18:54:04
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
QueryRegValue Woes... Please help.
Miscellaneous
Thread ID:
00178311
Message ID:
00178311
Views:
81
Below is a small prg for testing. I am having big troubles with retrieving the reg values. If anyone has an example of retrieving a value I would really appreciate it. I am trying to help another dept and we are against a deadline for testing... Thanks in advance!

This part is ok ...
   DECLARE Integer RegOpenKeyEx IN Win32API ;
     Integer nHKey, String @cSubKey, Integer nReserved, ;
     Integer nReservedA, Integer @nResult

  DECLARE Integer RegCreateKey IN Win32API ;
     Integer nHKey, String @cSubKey, Integer @nResult

  DECLARE Integer RegCloseKey IN Win32API Integer nHKey
  
  DECLARE Integer RegSetValueEx IN Win32API ;  
     Integer hKey, String lpszValueName, Integer dwReserved,;
     Integer fdwType, String lpbData, Integer cbData

  DECLARE Integer RegQueryValueEx IN Win32API ;
     Integer nHKey, String lpszValueName, Integer dwReserved,;
     Integer @lpdwType, String @lpbData, Integer @lpcbData

* Registry roots fox style  
#DEFINE HKEY_CLASSES_ROOT           -2147483648  && BITSET(0,31)
#DEFINE HKEY_CURRENT_USER           -2147483647  && BITSET(0,31)+1
#DEFINE HKEY_LOCAL_MACHINE          -2147483646  && BITSET(0,31)+2
#DEFINE HKEY_USERS                  -2147483645  && BITSET(0,31)+3
* Data types for keys
#DEFINE REG_SZ 				1	&& Data string
#DEFINE REG_BINARY 			3	&& Binary data in any form.
#DEFINE REG_DWORD 			4	&& A 32-bit number.

* Data types labels
#DEFINE REG_BINARY_LOC		"*Binary*"			&& Binary data in any form.
#DEFINE REG_DWORD_LOC 		"*Dword*"			&& A 32-bit number.
#DEFINE REG_UNKNOWN_LOC		"*Unknown type*"	&& unknown type

retval = 0
lphKey = 0

x = RegCreateKey(HKEY_CURRENT_USER, "\Software\Cyberjet\TestApp", @retval)

sKeyName = "Software\CyberJet\TestApp"
sDataName = "OurTest"
sDataValue = "CyberJet"
lLen = Len(sDataValue)

ret = RegOpenKeyEx(HKEY_CURRENT_USER, sKeyName, 0, 0, @lphKey)
ret = RegSetValueEx(@lphKey, sDataName, 0, 1, sDataValue, lLen)
**--------------------------------------------------------------**
**--------------------------------------------------------------**
Everything above here works as advertised.
The problem starts here?.
**--------------------------------------------------------------**
**--------------------------------------------------------------**

	cValueName = sDataName
	cKeyValue = ""
	nCurrentKey = HKEY_CURRENT_USER

	LOCAL lpdwReserved,lpdwType,lpbData,lpcbData,nErrCode
	STORE 0 TO lpdwReserved,lpdwType
	STORE SPACE(256) TO lpbData
	STORE LEN(m.lpbData) TO m.lpcbData

	nErrCode=RegQueryValueEx(nCurrentKey,cValueName,;
	lpdwReserved,@lpdwType,@lpbData,@lpcbData)

	m.cKeyValue = LEFT(lpbData,lpcbData-1)
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Reply
Map
View

Click here to load this message in the networking platform