Finishing the Client for an Internet Access Control Application - Check the ini file
(Page 2 of 4 )
The second thing that happens, just before the client connects, is that it checks to see if an ini file with the path to the ads directory exists:
procedure TForm1.FormShow(Sender: TObject);
var
settings : TINIFile;
begin
settings := TINIFile.Create(ExtractFilePath(Application.EXEName) + 'settings.ini');
try
path:=settings.ReadString('Path', 'pathdir', 'Empty');
finally
settings.Free;
end;
//check if path is set..
if path= 'Empty' then begin
//if path is not set in ini file then set the default path:
path:='intertimerstart.html';
end;
if form1.Visible then
begin
setof.Enabled:=true;
{ if form1.FuncAvail('USER32.DLL', 'BlockInput', @BlockInput) then
begin
BlockInput(true) ;
Sleep(10000) ;
BlockInput(false) ;
end; }
end
else begin
form1.Visible:=true;
if form1.FuncAvail('USER32.DLL', 'BlockInput', @BlockInput) then
begin
BlockInput(true) ;
Sleep(10000) ;
BlockInput(false) ;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin{
tc.Host:='127.0.0.1';
tc.Port:=1150;
with tc do
begin
try
Connect;
Socket.WriteLn(edname.text+':free@plchldr');
//Socket.WriteLn(GetComputername+':free@plchldr');
except on E : Exception do
showmessage('Could not connect to remote host. Check to see if you entered the right IP address');
end;
end; }
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showWindow(findwindow('shell_traywnd',nil), sw_show);
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
// wb.Navigate(path);
end;
procedure TForm1.setofTimer(Sender: TObject);
begin
//if setoff is false then block mouse/keyboard access..
if not setoff then
begin
if FuncAvail('USER32.DLL', 'BlockInput', @BlockInput) then
begin
BlockInput(true) ;
end;
end
else
//setoff is true, enable mouse/keyb access
begin
if FuncAvail('USER32.DLL', 'BlockInput', @BlockInput) then
begin
BlockInput(false);
// form1.Timer1.Enabled:=false;
end;
end;
end;
end.
Next: Code Explained >>
More Delphi-Kylix Articles
More By David Web