Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Windows Registry
Message
From
24/07/2002 18:03:36
 
 
To
24/07/2002 16:57:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00682260
Message ID:
00682332
Views:
11
#define REG_NONE 0
* // No value type

#define REG_SZ 1
* // Unicode nul terminated string

#define REG_EXPAND_SZ 2
* // Unicode nul terminated string

* // (with environment variable references)
#define REG_BINARY 3
* // Free form binary

#define REG_DWORD 4
* // 32-bit number

#define REG_DWORD_LITTLE_ENDIAN 4
* // 32-bit number (same as REG_DWORD)

#define REG_DWORD_BIG_ENDIAN 5
* // 32-bit number

#define REG_LINK 6
* // Symbolic Link (unicode)

#define REG_MULTI_SZ 7
* // Multiple Unicode strings

#define REG_RESOURCE_LIST 8
* // Resource list in the resource map

#define REG_FULL_RESOURCE_DESCRIPTOR 9
* // Resource list in the hardware description

#define REG_RESOURCE_REQUIREMENTS_LIST 10
**********************************************
#define KEY_QUERY_VALUE 0x0001
#define KEY_SET_VALUE 0x0002
#define KEY_CREATE_SUB_KEY 0x0004
#define KEY_ENUMERATE_SUB_KEYS 0x0008
#define KEY_NOTIFY 0x0010
#define KEY_CREATE_LINK 0x0020

#define KEY_READ KEY_QUERY_VALUE+KEY_ENUMERATE_SUB_KEYS+KEY_NOTIFY
#define KEY_WRITE KEY_SET_VALUE+KEY_CREATE_SUB_KEY

#define KEY_EXECUTE KEY_READ
#define KEY_ALL_ACCESS KEY_QUERY_VALUE+KEY_SET_VALUE+;
KEY_CREATE_SUB_KEY+KEY_ENUMERATE_SUB_KEYS+;
KEY_NOTIFY+KEY_CREATE_LINK
***********************************************************
#define HKEY_CLASSES_ROOT 0x80000000
#define HKEY_CURRENT_USER 0x80000001
#define HKEY_LOCAL_MACHINE 0x80000002
#define HKEY_USERS 0x80000003
#define HKEY_PERFORMANCE_DATA 0x80000004
#define HKEY_CURRENT_CONFIG 0x80000005
#define HKEY_DYN_DATA 0x80000006
***********************************************************
DECLARE INTEGER RegSetValueEx IN Win32API;
INTEGER hKey, STRING lpValueName, INTEGER Reserved,;
INTEGER dwType, STRING lpData, INTEGER DataSize
********************************************
DECLARE INTEGER RegOpenKeyEx IN Win32API;
INTEGER hKey, STRING lpValueName, INTEGER Reserved,;
INTEGER samDesired, INTEGER @Result
********************************************
DECLARE INTEGER RegCloseKey IN Win32API;
INTEGER hKey
********************************************
Declare LONG RegQueryValueEx IN Win32API;
Integer hKey,String lpValueName,Integer @ lpReserved,;
Integer @ lpType,String lpData,Integer @ lpcbData
Local lnP,lcOld,lnType,lnSize,lcBuffer,lnReserved
lnReserved=0
lcBuffer=Replicate(Chr(0),1024)
lnType=0
lnSize=0
lcOld=""
lnP=0
*lnP - for my key
*Let lcKey="[your path from HKEY_CURRENT_USER]"
*Let lcNew -new value(String) for lcKey
*Let lcOld - old value from lcKey
lcNew=AllTrim(lcNew)+Chr(0)
If RegOpenKeyEx(HKEY_CURRENT_USER,lcKey,KEY_QUERY_VALUE+KEY_SET_VALUE,@lnP)=0
If RegQueryValueEx(lnP,'',@lnReserved,@lnType,@lcBuffer,@lnSize)=0
lcOld=Left(lcBuffer,lnSize-1)
* We are Readed
EndIf
If RegSetValueEx(lnP,'',0,REG_SZ,lcNew,Len(lcNew))=0
* We are Writed
EndIf
RegCloseKey(lnP)
EndIf
Previous
Reply
Map
View

Click here to load this message in the networking platform