Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need a component to control access to Internet

Status
Not open for further replies.

oigo

Programmer
Apr 27, 2002
23
CO
Hello, I am looking for a component to control the access to Internet and bill the time of a connection, I need to set the time of a connection to Internet, what do you recommend to me ?

thanks
 
Whatever components you use you will have to tell that component to connect at some point so just start a timer when you successfully connect. Set the timer event to disconnect if thats what you want after whetever period of time you require has elapsed.

As for working out a bill, it depends on how much you service provider charges per minute (if its not a standard monthly charge) so just multiply the cost per minute by the number of minutes you are connected for. Arte Et Labore
 
I can give not a comp but a code do some trics

example 1 (opening internet address)
------------
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw;

type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Edit1: TEdit;
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
procedure go;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}
procedure TForm1.go;
var
yontem: OleVariant;
begin
yontem := 0;
WebBrowser1.Navigate(WideString(edit1.Text),yontem,yontem,yontem,yontem);
end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then
go;
end;

end.

example 2 internet status
----------
uses wininet;

function UserOnline:boolean;
var
connect_status:dword;
begin
connect_status := 2 {lan} +
1 {modem} +
4 {proxy} ;
result := InternetGetConnectedState(@connect_status,0);
end;

if UserOnline = true then ShowMessage('Internet connection stat: Online')
else
ShowMessage('Internet connection stat: Offline');

example 3 (address verification)
---------
uses wininet;

function CheckUrl(url:string):boolean;
var
hSession, hfile, hRequest: hInternet;
dwindex,dwcodelen :dword;
dwcode:array[1..20] of char;
res : pchar;
begin
if pos(' then
url := 'Result := false;
hSession := InternetOpen('InetURL:/1.0',
INTERNET_OPEN_TYPE_PRECONFIG,nil, nil, 0);
if assigned(hsession) then
begin
hfile := InternetOpenUrl(
hsession,
pchar(url),
nil,
0,
INTERNET_FLAG_RELOAD,
0);
dwIndex := 0;
dwCodeLen := 10;
HttpQueryInfo(hfile, HTTP_QUERY_STATUS_CODE,
@dwcode, dwcodeLen, dwIndex);
res := pchar(@dwcode);
result:= (res ='200') or (res ='302');
if assigned(hfile) then
InternetCloseHandle(hfile);
InternetCloseHandle(hsession);
end;

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if CheckUrl(Edit1.Text) then
Label1.Caption := 'Valid'
else
Label1.Caption := 'Invalid'
end;

example 4
---------
uses Shellapi
ShellExecute(0, nil, ' nil, nil, SW_SHOWDEFAULT);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top