Bueno muchachos, hice los cambios y no funciona.
Los errores del compilador son estos:
Cita:
[Error] NGFS.pas(68): Undeclared identifier: 'RegNGFS'
[Error] NGFS.pas(69): Missing operator or semicolon
[Error] NGFS.pas(70): 'THEN' expected but identifier 'OpenKey' found
[Error] NGFS.pas(71): Missing operator or semicolon
[Error] NGFS.pas(72): Missing operator or semicolon
..... el mismo error hasta línea 78
[Error] NGFS.pas(81): Statement expected but 'PROCEDURE' found
..... luego lo mismo para el otro procedimiento y termina con
[Hint] NGFS.pas(39): Private symbol 'RegNGFS' declared but never used
[Error] NGFS.pas(43): Unsatisfied forward or external declaration: 'TForm1.ReadRegistry'
[Error] NGFS.pas(45): Unsatisfied forward or external declaration: 'TForm1.WriteRegistry'
[Fatal Error] Focuser.dpr(5): Could not compile used unit 'NGFS.pas'
|
El código es este (Eliminé la parte de "Type" para que no fuera tan largo):
Código Delphi
[-]
unit NGFS;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls, CPortCtl, CPort, Registry;
type
...........................
private
RegNGFS: TRegistry;
public
procedure ReadRegistry(MaxSteps: Integer; MinSteps: Integer;
StopOUT: Integer; StopIN: Integer; COMPort: String);
procedure WriteRegistry( );
end;
var
Form1: TForm1;
MaxSteps: Cardinal; MinSteps: Cardinal; StopOUT: Cardinal; StopIN: Cardinal; COMPort: String;
implementation
{$R *.dfm}
procedure ReadRegistry(MaxSteps: Integer; MinSteps: Integer;
StopOUT: Integer; StopIN: Integer; COMPort: String);
begin
try
RegNGFS:= TRegistry.Create;
RegNGFS.RootKey := HKEY_LOCAL_MACHINE;
if RegNGFS.OpenKey('SOFTWARE\NGFS', FALSE) then begin
RegNGFS.ReadCardinal('MaxSteps');
MinSteps:= RegNGFS.ReadCardinal('MinSteps');
StopOUT:= RegNGFS.ReadCardinal('StopOUT');
StopIN:= RegNGFS.ReadCardinal('StopIN');
COMPort:= RegNGFS.ReadString('COMPort');
end;
finally
RegNGFS.Free;
end;
procedure WriteRegistry( );
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.