Subject | RE: [ib-support] TIBBackupService |
---|---|
Author | Pete Bray |
Post date | 2001-07-01T18:30:42Z |
Hi,
i use the code below to stop this happening when i connect to the database,
something like this may fix your problem.
ie.
StoredSetting:=StopDialUpAutoDial();
try
Database.Open();
finally
RestoreDialUpAutoDial(StoredSetting);
end; //of try..finally
the full function source is below...
{-------------------------------------------------------}
{-------------------------------------------------------}
function StopDialUpAutoDial:longint;
const
RegPath = 'Software\Microsoft\Windows\CurrentVersion\Internet Settings';
EnableAutoDial = 'EnableAutoDial';
DisableIt:Longint = 0;
var
Registry:TRegistry;
RegistryOldSetting:longint;
begin
StopDialUpAutoDial:=0;
if Win32Platform<>VER_PLATFORM_WIN32_NT then
begin
try
try
Registry:=TRegistry.Create();
if Registry.OpenKey(RegPath,false) then
begin
Registry.ReadBinaryData(EnableAutoDial,RegistryOldSetting,sizeof(RegistryOld
Setting));
StopDialUpAutoDial:=RegistryOldSetting;
if RegistryOldSetting<>DisableIt
then
Registry.WriteBinaryData(EnableAutoDial,DisableIt,sizeof(DisableIt));
end; //of if
finally
if assigned(Registry) then Registry.Free;
end; //of try..finally
except //catch all
end; //of try except
end; //of if
end; //of procedure StopDialUpAutoDial
{-------------------------------------------------------}
{-------------------------------------------------------}
procedure RestoreDialUpAutoDial(OldValue:longint);
const
RegPath = 'Software\Microsoft\Windows\CurrentVersion\Internet Settings';
EnableAutoDial = 'EnableAutoDial';
var
Registry:TRegistry;
RegistrySetting:longint;
begin
if Win32Platform<>VER_PLATFORM_WIN32_NT then
begin
try
try
Registry:=TRegistry.Create();
if Registry.OpenKey(RegPath,false) then
begin
Registry.ReadBinaryData(EnableAutoDial,RegistrySetting,sizeof(RegistrySettin
g));
if RegistrySetting<>OldValue
then
Registry.WriteBinaryData(EnableAutoDial,OldValue,sizeof(OldValue));
end; //of if
finally
if assigned(Registry) then Registry.Free;
end; //of try..finally
except //catch all
end; //of try except
end; //of if
end; //of procedure RestoreDialUpAutoDial
Kind regards, Pete Bray
pete@...
i use the code below to stop this happening when i connect to the database,
something like this may fix your problem.
ie.
StoredSetting:=StopDialUpAutoDial();
try
Database.Open();
finally
RestoreDialUpAutoDial(StoredSetting);
end; //of try..finally
the full function source is below...
{-------------------------------------------------------}
{-------------------------------------------------------}
function StopDialUpAutoDial:longint;
const
RegPath = 'Software\Microsoft\Windows\CurrentVersion\Internet Settings';
EnableAutoDial = 'EnableAutoDial';
DisableIt:Longint = 0;
var
Registry:TRegistry;
RegistryOldSetting:longint;
begin
StopDialUpAutoDial:=0;
if Win32Platform<>VER_PLATFORM_WIN32_NT then
begin
try
try
Registry:=TRegistry.Create();
if Registry.OpenKey(RegPath,false) then
begin
Registry.ReadBinaryData(EnableAutoDial,RegistryOldSetting,sizeof(RegistryOld
Setting));
StopDialUpAutoDial:=RegistryOldSetting;
if RegistryOldSetting<>DisableIt
then
Registry.WriteBinaryData(EnableAutoDial,DisableIt,sizeof(DisableIt));
end; //of if
finally
if assigned(Registry) then Registry.Free;
end; //of try..finally
except //catch all
end; //of try except
end; //of if
end; //of procedure StopDialUpAutoDial
{-------------------------------------------------------}
{-------------------------------------------------------}
procedure RestoreDialUpAutoDial(OldValue:longint);
const
RegPath = 'Software\Microsoft\Windows\CurrentVersion\Internet Settings';
EnableAutoDial = 'EnableAutoDial';
var
Registry:TRegistry;
RegistrySetting:longint;
begin
if Win32Platform<>VER_PLATFORM_WIN32_NT then
begin
try
try
Registry:=TRegistry.Create();
if Registry.OpenKey(RegPath,false) then
begin
Registry.ReadBinaryData(EnableAutoDial,RegistrySetting,sizeof(RegistrySettin
g));
if RegistrySetting<>OldValue
then
Registry.WriteBinaryData(EnableAutoDial,OldValue,sizeof(OldValue));
end; //of if
finally
if assigned(Registry) then Registry.Free;
end; //of try..finally
except //catch all
end; //of try except
end; //of if
end; //of procedure RestoreDialUpAutoDial
Kind regards, Pete Bray
pete@...