FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Pocket PC Leer y grabar valores del registro de Windows
Posts: 654
Joined: Mon May 29, 2006 03:14 PM
Leer y grabar valores del registro de Windows
Posted: Tue Feb 24, 2009 07:17 PM
Quisiera poder leer y grabar valores del registro de Windows Mobile versi贸n 5 o 6.

En algunos lenguajes es asi:
Para leer: RegRead ("HKCU", "ControlPanel\Backlight", "ACTimeout")
Para grabar: RegWriteDword ("HKCU", "ControlPanel\Backlight", "Brightness", 10)

Gracias.
Mi abuelo dec铆a: Los aviones vuelan porque Dios quiere, y los helic贸pteros ni Dios sabe porque vuelan.

FWH 16.02, xHarbour 1.2.3, Harbour 3.2.0, WorkShop 4.5, AJ Make 0.30, Borlan BCC 7.00, VisualStudio 2013
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Leer y grabar valores del registro de Windows
Posted: Wed Feb 25, 2009 12:07 AM
JM,

FWPPC proporciona la Clase TReg32, aqui tienes un ejemplo de uso (probado en PC):
Code (fw): Select all Collapse
// Managing Register services from FiveWin
#include "FWCE.Ch"

#define  HKEY_LOCAL_MACHINE      2147483650

//---------------------------------------------------------------------------//

function Main()

   LOCAL oReg, cName, uVar

   oReg := TReg32():Create( HKEY_LOCAL_MACHINE, "SOFTWARE\FiveWin\Reg32 Class Test" )

   // Call Set with an empty string to access the default key

   oReg:Set( "", "This is the default value" )
   oReg:Set( "A number", 12345 )
   oReg:Set( "A Date", DATE() )
   oReg:Set( "A logical value", .F. )
   MsgStop( "Windows registry updated!" )

   oReg:Close()

   oReg := TReg32():New( HKEY_LOCAL_MACHINE, "SOFTWARE\FiveWin\Reg32 Class Test" )

   uVar := oReg:Get( "", "This is the default value" )
   MsgStop( uVar, "Default: VALTYPE()= " + VALTYPE( uVar ) )
   uVar := oReg:Get( "A number", 12345 )
   MsgStop( uVar, "A number: VALTYPE()= " + VALTYPE( uVar ) )
   uVar := oReg:Get( "A Date", DATE() )
   MsgStop( uVar, "A Date: VALTYPE()= " + VALTYPE( uVar ) )
   uVar := oReg:Get( "A logical value", .F. )
   MsgStop( uVar,"Logic: VALTYPE()= " + VALTYPE( uVar ) )

   oReg:Close()

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 654
Joined: Mon May 29, 2006 03:14 PM
Re: Leer y grabar valores del registro de Windows
Posted: Thu Feb 26, 2009 07:21 PM
Antonio Linares wrote:
Code (fw): Select all Collapse
#define  HKEY_LOCAL_MACHINE      2147483650


驴 Cuales son los valores para HKEY_CLASS_ROOT, HKEY_CURRENT_USER y HKEY_USERS ?

Probaremos a ver...
Mi abuelo dec铆a: Los aviones vuelan porque Dios quiere, y los helic贸pteros ni Dios sabe porque vuelan.

FWH 16.02, xHarbour 1.2.3, Harbour 3.2.0, WorkShop 4.5, AJ Make 0.30, Borlan BCC 7.00, VisualStudio 2013
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Leer y grabar valores del registro de Windows
Posted: Thu Feb 26, 2009 07:51 PM

JM,

define HKEY_CLASSES_ROOT 2147483648

define HKEY_CURRENT_USER 2147483649

define HKEY_LOCAL_MACHINE 2147483650

define HKEY_USERS 2147483651

defien HKEY_CURRENT_CONFIG 2147483653

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 654
Joined: Mon May 29, 2006 03:14 PM
Re: Leer y grabar valores del registro de Windows
Posted: Wed Mar 04, 2009 08:55 PM

Y una 煤ltima pregunta:

Suponemos que NO SE QUE "campos" tiene el registro... 驴 Como podemos saber cuantos (y cuales) tiene cada directorio del registro ?

Gracias.

Mi abuelo dec铆a: Los aviones vuelan porque Dios quiere, y los helic贸pteros ni Dios sabe porque vuelan.

FWH 16.02, xHarbour 1.2.3, Harbour 3.2.0, WorkShop 4.5, AJ Make 0.30, Borlan BCC 7.00, VisualStudio 2013
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Leer y grabar valores del registro de Windows
Posted: Thu Mar 05, 2009 01:11 AM
JM,

Aqui tienes un ejemplo probado en el PC:
Code (fw): Select all Collapse
#define  HKEY_LOCAL_MACHINE      2147483650

#define  ERROR_SUCCESS                    0

function Main()

   local hKey, cName, uValue, n := 0

   RegOpenKey( HKEY_LOCAL_MACHINE,;
               "Software\Microsoft\Windows\CurrentVersion\Run", @hKey )
   
   while RegEnumValue( hKey, n++, @cName, @uValue ) == ERROR_SUCCESS
      MsgInfo( cName )
      MsgInfo( uValue )
   end

   RegCloseKey( hKey )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 144
Joined: Sun Dec 18, 2005 03:18 PM
Re: Leer y grabar valores del registro de Windows
Posted: Thu Nov 12, 2009 12:40 PM
Probado con esta clave del registro devuelve valores incoherentes :-) . Compilado con el SDK de WMB5.
Code (fw): Select all Collapse
#define HKEY_CURRENT_USER 2147483649 

#define 聽ERROR_SUCCESS 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽0

function Main()

聽 聽local hKey, cName, uValue, n := 0

聽 聽RegOpenKey( HKEY_CURRENT_USER,;
聽 聽 聽 聽 聽 聽 聽 聽"ControlPanel\Notifications\{8ddf46e7-56ed-4750-9e58-afc6ce486d03}", @hKey 
聽 聽
聽 聽while RegEnumValue( hKey, n++, @cName, @uValue ) == ERROR_SUCCESS
聽 聽 聽 MsgInfo( cName )
聽 聽 聽 MsgInfo( uValue )
聽 聽end

聽 聽RegCloseKey( hKey )

return nil
Saludos

Salvador

Continue the discussion