Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ler e Gravar no registro do Windows
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00727949
Message ID:
00757987
Views:
36
Alow Fábio....

Esse UT é realmente legal... Nem precisei perguntar, a resposta já estava aqui! :-)
Seguinte, eu preciso ler e gravar no registro do Windows. Mas isso tem que funcionar para qualquer versão do SO, desde Win95 até WinXP.
Você sabe me dizer se a rotina abaixo funciona com todos os SOs? ... repito: TODOS WINDOWS? ;-)

[]s
#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
LOCAL loRegistry
loRegistry = NEWOBJECT("Registry", HOME() + "Ffc\Registry")
*
* Lendo...
*
LOCAL lcProductID
IF loRegistry.GetRegKey("ProductID", ;
                        @lcProductID, ;
                        "SOFTWARE\Microsoft\VisualFoxPro\7.0\Registration", ;
                        HKEY_LOCAL_MACHINE) = 0
  MESSAGEBOX(lcProductID)
ENDIF
*
* Escrevendo...
*
loRegistry.OpenKey("SOFTWARE\NovoFornecedor\NovoProduto", HKEY_LOCAL_MACHINE, .T.)
loRegistry.SetRegKey("NovaChave", ;
                     lcProductID, ;
                     "SOFTWARE\NovoFornecedor\NovoProduto", ;
                     HKEY_LOCAL_MACHINE)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Rodolfo Duarte
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform