Alistar,
The default parameters option will not work while the method/procedure is
expecting VAR parameters. Also, you cannot overload a method that is
declared in the same class - you can only overload in a descendant class.
You have to use the overload directive in the base class, and again in the
descendant class.
The options you have are:
1) use a dummy procedure (not expecting any parameters) called something
else that calls the RegStatus method.
2) create an ancestor form class that has the method on it using the
overload directive
3) find a way to use the original RegStatus function without having to pass
the parameters as VARs
4) wrap the functionality up into a separate object and make the parameters
of the function into properties of the object (along with other values such
as the regestry paths and keys. Then when the method is called it can refer
to it's own properties.
Personally, I think option 4 is the best way to go - but I don't know the
context of your code so it's just a guess.
Cheers,
Phil.
----- Original Message -----
From: "Alistair Grant George" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 27, 2004 7:21 PM
Subject: Re[2]: [DUG] Sundays stupid question
> If I subst with default values compiler error as before.
> Here is the declaration:
> function RegStatus(var TrialDays:word; var Key:string;License: string):
Boolean;
> Then the proc:
> function Tmainform.RegStatus(var TrialDays:word; var Key:string;License:
string): Boolean;
> var INIfile: Tinifile;
> guid, Rcode: string;
> Today, EndDay: Integer;
>
> function GetLicense: string;
> var Reg: TRegistry;
> VersionInfo: TOSVersionInfo;
> begin
> Result := '';
> VersionInfo.dwOSVersionInfoSize := sizeOf(TOSVersionInfo);
> GetVersionEx(VersionInfo);
> Reg := TRegistry.Create;
> Reg.RootKey := HKEY_LOCAL_MACHINE;
> case VersionInfo.dwPlatformID of
> VER_PLATFORM_WIN32_WINDOWS: begin
> Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion', TRUE);
> result := Reg.ReadString('ProductID');
> end;
> VER_PLATFORM_WIN32_NT: begin
> Reg.OpenKey('\Software\Microsoft\Windows NT\CurrentVersion',
TRUE);
> result := Reg.ReadString('ProductID');
> end;
> end;
> end;
> begin
> //proc code follows here
> end;
>
>
> NM> post soem code. I assume you are calling the reg check
> NM> first with the parameters and subsequently without, I'm not sure why
you
> NM> are using vars
>
>
> _______________________________________________
> Delphi mailing list
> [EMAIL PROTECTED]
> http://ns3.123.co.nz/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi