Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 175
  • Last Modified:

Internet Timer

Can anyone help me with an internet timer ? It must create a log file with the start time, end time, total time and the total cost of the call. It must also take into account peak and offpeak hours.

It must also be in running at startup and monitor all connections and start the timer when anyone of the dialup accounts are activated.

Thank you
0
DigitalNam
Asked:
DigitalNam
1 Solution
 
CesarioCommented:
Hi DigitalNam,

1) Place a Timer on your Form

2) some globale var...
   NewSession : Boolean;
   Startime   : DWORD;
   EndTime    : DWORD;
   StartDate  : TDateTime
   EndDate    : TDateTime;
   TotSec     : LongInt;

2) Detecting If You Have a Connection to the Internet
   http://support.microsoft.com/support/kb/articles/Q242/5/58.ASP

3) If you are connected
     - IF NewSession = False:
         NewSession := True;
         StartTime  := GetTickCount;
         StartDate  := Now;
                 
   IF Not
     - IF NewSessaion = TRUE
          EndTime := GetTickCount;
          EndDate := Now;
          TotSec  := (EndTime-StartTime) DIV 1000;
          NewSession := False;
          Calculate the costs
          Put this Data to you Database
           

4)  To Show the picks you can use a TChart


Best Regards

Cesario
0
 
CesarioCommented:
sorry it was the rong link :-)

uses WinInet;  

procedure Connected:Boolean;
var
  dwConnectionTypes : DWORD;
begin
  dwConnectionTypes := 1; // Modem
  Result := InternetGetConnectedState(@dwConnectionTypes, 0)
end;
0
 
CesarioCommented:
another function to check if you are connected or not

uses wininet;

function Online(var Modem, LAN, Proxy, Busy : boolean) : boolean; //Testet: Internet connection vorhanden +Art ? // var
 flags : dword;
begin
  Result := InternetGetConnectedState(@flags, 0);
  if Result then
  begin
    if (flags and INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM then
    begin
      Modem := True;
    end;
    if (flags and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then
    begin
      LAN := True;
    end;
    if (flags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY then
    begin
      Proxy := True;
    end;
    if (flags and INTERNET_CONNECTION_MODEM_BUSY)=INTERNET_CONNECTION_MODEM_BUSY then
    begin
      Busy := True;
    end;
  end;
end;
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AvonWyssCommented:
Cesario, goot hint with the Online function. However, it does not return what type of connection is to be used when the internet is not connected. And the MODEM_BUSY part is not used (as per MSDN, October 1999). So I'd implement your function like this:

function Online(var Modem, LAN, Proxy: Boolean): Boolean; //Testet: Internet connection vorhanden
var
     flags: Cardinal;
begin
     Result:=InternetGetConnectedState(@flags,0);
     Modem:=flags and INTERNET_CONNECTION_MODEM>0;
     LAN:=flags and INTERNET_CONNECTION_LAN>0;
     Proxy:=flags and INTERNET_CONNECTION_PROXY>0;
end;

DigitalNam, in case you like it, credits still go to Cesario for this code.
0
 
DelFreakCommented:
Listening...
0
 
edeyCommented:
I would think there should be some points coming Cesario's way, no?


GL
Mike
0
 
DigitalNamAuthor Commented:
Not actually what I was looking for, but made me think in another way. Thanks.

PS: Bought source code from another author.
0
 
DigitalNamAuthor Commented:
Not actually what I was looking for, but made me think in another way. Thanks.

PS: Bought source code from another author.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now