Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 11-10-2005
CelestronFan CelestronFan is offline
Miembro
 
Registrado: oct 2005
Posts: 14
Poder: 0
CelestronFan Va por buen camino
Ayuda con TRegistry

Saludos a todos.

Hace unos días solicité ayuda con respecto a la lectura y escritura del registro Windows. Luego de leer sobre TRegistry, hice las rutinas correpondiente y la declaración de las variables y uses necesarios. El compilador me arroja un error diciéndome que la variable RegNGFS no está declarada. ¿Podría alguien indicarme que es lo que está mal en el código?

Por cierto, ¿está bien hecha la declaración den enteros sin signo, Cardinal?

Muchas Gracias.

Código Delphi [-]
unit NGFS;
 
 interface
 
 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
   Forms, Dialogs, StdCtrls, ComCtrls, ExtCtrls, CPortCtl, CPort, Registry;
 
 type
   TForm1 = class(TForm)
     BIn: TButton;
     BOut: TButton;
     GroupBox1: TGroupBox;
     LCurrPos: TLabel;
     Label2: TLabel;
     Label3: TLabel;
     Label4: TLabel;
     Label5: TLabel;
     Label6: TLabel;
     BGoto: TButton;
     LTotStep: TLabel;
     BCali: TButton;
     PBCurrPos: TProgressBar;
     Timer1: TTimer;
     ComComboBox1: TComComboBox;
     ComPort1: TComPort;
     ComLed1: TComLed;
     Eminstep: TEdit;
     Emaxstep: TEdit;
     Label1: TLabel;
     Eminstop: TEdit;
     Label7: TLabel;
     Emaxstop: TEdit;
     BConnect: TButton;
     EGoto: TEdit;
   private
     { Private declarations }
     RegNGFS: TRegistry;
   public
     { Public declarations }
   end;
 
 var
   Form1: TForm1;
   MaxSteps: Cardinal; //Número máximo de pasos del Stepper
   MinSteps: Cardinal; //Número mínimo de pasos del Stepper
   StopOUT: Cardinal; //Posición de parada sentido OUT del Stepper
   StopIN: Cardinal; //Posición de parada sentido IN del Stepper
   COMPort: String; //Puerto Serial seleccionado
 
 implementation
 
 {$R *.dfm}
 
 procedure ReadRegistry( MaxSteps: Cardinal; MinSteps: Cardinal;
   StopOUT: Cardinal; StopIN: Cardinal; COMPort: String);
 //Procedimiento para leer el registro//
 begin
   try
     RegNGFS:= TRegistry.Create;
     RegNGFS.RootKey := HKEY_LOCAL_MACHINE;
     if RegNGFS.OpenKey('SOFTWARE\NGFS', FALSE) then begin
       MaxSteps:= RegNGFS.ReadCardinal('MaxSteps');
       MinSteps:= RegNGFS.ReadCardinal('MinSteps');
       StopOUT:= RegNGFS.ReadCardinal('StopOUT');
       StopIN:= RegNGFS.ReadCardinal('StopIN');
      COMPort:= RegNGFS.ReadString('COMPort');
     end;
   finally
     RegNGFS.Free;
   end;
 end;
 
 procedure WriteRegistry( );
 //Procedimiento para escribir el registro//
 begin
   try
     RegNGFS:= TRegistry.Create;
     RegNGFS.RootKey := HKEY_LOCAL_MACHINE;
     if RegNGFS.OpenKey('SOFTWARE\NGFS', TRUE) then begin
       RegNGFS.WriteCardinal('MaxSteps', MaxSteps);
       RegNGFS.WriteCardinal('MinSteps', MinSteps);
       RegNGFS.WriteCardinal('StopOUT', StopOUT);
       RegNGFS.WriteCardinal('StopIN', StopIN);
       RegNGFS.WriteString('COMPort', COMPort);
     end;
   finally
     RegNGFS.Free;
   end;
 end;
 
 end.

Última edición por dec fecha: 11-10-2005 a las 02:33:08. Razón: Ajustar el ancho del texto.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 23:15:57.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi