[DUG] comobject
Leigh Wanstead
leighw at softtech.co.nz
Fri Jan 26 16:47:03 NZDT 2007
I forgot remove comment // disable update registry
Here is the method.
TXXXAutoObjectFactory = class(TAutoObjectFactory)
public
procedure UpdateRegistry(Register: Boolean);
end;
procedure TXXXAutoObjectFactory.UpdateRegistry(Register: Boolean);
begin
try
inherited UpdateRegistry(Register);
except
on E: EOleRegistrationError do
begin
// User may not have write access to the registry.
end;
end;
end;
Regards
Leigh
www.smootharm.com
-----Original Message-----
From: Leigh Wanstead [mailto:leighw at softtech.co.nz]
Sent: Friday, 26 January 2007 4:44 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: RE: [DUG] comobject
Here is the method.
TXXXAutoObjectFactory = class(TAutoObjectFactory)
public
procedure UpdateRegistry(Register: Boolean);
end;
procedure TXXXAutoObjectFactory.UpdateRegistry(Register: Boolean);
begin
// disable update registry
try
inherited UpdateRegistry(Register);
except
on E: EOleRegistrationError do
begin
// User may not have write access to the registry.
end;
end;
end;
Regards
Leigh
www.smootharm.com
-----Original Message-----
From: delphi-bounces at ns3.123.co.nz
[mailto:delphi-bounces at ns3.123.co.nz]On Behalf Of Phil Middlemiss
Sent: Friday, 26 January 2007 2:24 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] comobject
Hi Leigh,
yes, we had this exact problem (with D6 tho) and we had to basically go
into the VCL and edit the code ourselves. It was suggested online by
someone (can't remember who), but we basically edited ComServ.pas,
editing the TComServer.Intialize as follows:
procedure TComServer.Initialize;
begin
try
UpdateRegistry(FStartMode <> smUnregServer);
except
on EOleSysError do
if FStartMode = smRegServer then raise;
on E: EOleRegistrationError do
// User may not have write access to the registry.
// Squelch the exception unless we were explicitly told to register.
if FStartMode = smRegServer then raise;
end;
if FStartMode in [smRegServer, smUnregServer] then Halt;
ComClassManager.ForEachFactory(Self, FactoryRegisterClassObject);
end;
Hope this helps,
Cheers,
Phil.
Leigh Wanstead wrote:
> Hello everyone,
>
> Here is the sequence for a Delphi 7 comserver startup to call
CreateRegKey.
>
> procedure TApplication.Initialize;
> procedure InitComServer;
> procedure TComServer.Initialize;
> procedure TComServer.UpdateRegistry(Register: Boolean);
> procedure TComClassManager.ForEachFactory(ComServer: TComServerObject;
> FactoryProc: TFactoryProc);
> procedure TComServer.FactoryUpdateRegistry(Factory: TComObjectFactory);
> procedure TTypedComObjectFactory.UpdateRegistry(Register: Boolean);
> procedure TComObjectFactory.UpdateRegistry(Register: Boolean);
> procedure CreateRegKey(const Key, ValueName, Value: string; RootKey: DWord
=
> HKEY_CLASSES_ROOT);
>
> I can understand that the delphi application needs to update registry. But
> there is no such need every time to update. It can be updated only once,
> after that there is no such need. The question is if the user who launch
my
> application does not create regristry rights, what to do? I don't want
user
> to have admin rights just to start my application.
>
> TIA
>
> Regards
> Leigh
>
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
>
>
>
More information about the Delphi
mailing list