Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get values error in my procedure(registry)
Message
From
31/01/2004 12:21:59
 
 
To
31/01/2004 08:56:54
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00872651
Message ID:
00872662
Views:
24
Raj

Doing some arrangements in your code we repaired it..
#define PATH_TO_MY_SUBKEY  "Software\aaa_test"
#define REG_SZ             ( 1 )          && Unicode nul terminated string
#define REG_DWORD          ( 4 )          && 32-bit number
#define HKEY_CLASSES_ROOT  ( 2147483648 )
#define HKEY_CURRENT_USER  ( 2147483649 )
#define HKEY_LOCAL_MACHINE ( 2147483650 )
#define HKEY_USERS         ( 2147483651 )

do go_declare

wait window "["+get_value("options1")+"]"

do set_value with "options1", "HiEveryone"

wait window "["+get_value("options1")+"]"

PROCEDURE set_value
PARAMETERS opt_name, value
aaa = 0
IF  RegCreate(HKEY_LOCAL_MACHINE, PATH_TO_MY_SUBKEY, @aaa)=0
    =RegSetValue(aaa, m.opt_name, 0, REG_SZ, m.value, LEN(m.value)+1)
    =RegClose(aaa)
    RETURN .T.
ENDIF
RETURN .F.


PROCEDURE get_value
LPARAMETERS opt_name

aaa                       = 0
res                       = 0
type                      = 0
data                      = SPACE(101)
data_size                 = 100
IF  RegOpen(HKEY_LOCAL_MACHINE, PATH_TO_MY_SUBKEY, @aaa)=0
    =RegGetValue(m.aaa, m.opt_name, @res, @type, @data, @data_size)
    =RegClose(m.aaa)
ENDIF
RETURN LEFT(m.data, m.data_size-1)

PROCEDURE go_declare
* Creates or opens registry subkey
DECLARE long RegCreateKeyA in advapi32 AS RegCreate long hkey, string subkey, long @phkey
DECLARE long RegOpenKeyA in advapi32 AS RegOpen long hkey, string subkey, long @phkey

* Creates or changes registry value
DECLARE long RegSetValueEx in advapi32 AS RegSetValue;
 long hkey, string value, long reserved, long type, string data, long data_size

* close key
declare integer RegCloseKey in Win32API as regclose integer nHKey

* Opens registry subkey
Declare Integer RegQueryValueEx In Win32API AS RegGetValue ;
  Integer nHKey, String lpszValueName, Integer dwReserved,;
  Integer @lpdwType, String @lpbData, Integer @lpcbData


return
**************************************************************************
HTH

Claudio
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Previous
Reply
Map
View

Click here to load this message in the networking platform