请问一下哪位高手知道怎么得到上网的时间!就是拨号上网的时间!!我的系统是XP请高手帮帮忙!!

解决方案 »

  1.   

    如果但是拨号上网比较简单,你可以自己编一个拨号程序,然后在响应程序中记录时间。只是几个api调用很简单。
      

  2.   

    采用Modem拨号上网方式,在Windows 95/98中,配置“拨号服务器”时,拨号服务器有一个属性,就是是否记录日志文件,其默认值是“否”。对于它,平常我们可能都没太注意。我们把它改成“是”,这样,在每次上网后,Windows 95就会在其安装目录下(通常就是C盘的Windows目录),把上网连通的时间以及上网过程中发生的事件记录在ppplog.txt日志文件中。 ---- ppplog.txt是一个标准的文本文件,在此文件中,上网发生的每个事件记录占有一行,格式为:  日期    时间 发生的事件
    |---------|-----------|-|---------------------|
    12-19-1998 21:54:31.25 
    - Microsoft 拨号网络适配器日志已打开。
    12-19-1998 21:54:31.25
     - 服务器类型是 PPP (点到点协议)。
    .
    .
    .
    12-19-1998 22:44:49.08
     - Microsoft 拨号网络适配器日志已关闭。---- 上述内容是简体中文Windows 98的ppplog.txt文件格式,对于Windows 95,基本格式是一样的,只是事件部分是英文的。 日期    时间 发生的事件
    |---------|-----------|-|---------------------|
    12-15-1998 16:34:27.71 
    - Remote access driver log opened.
    12-15-1998 16:34:27.71 
    - Installable CP VxD SPAP is loaded
    12-15-1998 16:34:27.71
     - Server type is  PPP (Point to Point Protocol).
    .
    .
    .
    12-15-1998 16:58:30.05 
    - Remote access driver log closed.
      

  3.   

    可以看看单元WinInet的函数—————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    —————————————————————————————————
      

  4.   

    读取的数据存放到数据库中。具体程序如下:  procedure TForm1.readlogExecute(Sender: TObject);
     var
       logfile: TextFile;
       logbak: TextFile;
       Str1: string;
       datestr,timestr:string;
     begin
       AssignFile(logbak,'c:\windows\ppplog.bak');
       if not FileExists('c:\windows\ppplog.bak') then
          Rewrite(logbak)
       else
          Append(logbak);
       if not FileExists('c:\windows\ppplog.txt') then
           MessageDlg('日志文件不存在',
           mtInformation,[mbOk],0)
       else
         begin
         AssignFile(logfile, 'c:\windows\ppplog.txt');
         Reset(logfile);
         if Eof(logfile) then
         begin
            ShowMessage('日志文件已为空');
            Exit;
         end;
         Table1.Open;
         while not Eof(logfile) do
         begin
          Readln(logfile, Str1);
     {‘log opened’作为计时的起点}
          if Pos('log opened',Str1)< >0 then
          begin
            datestr:=copy(str1,1,10);
            timestr:=copy(str1,12,8);
            Table1.Append;
            Table1.FieldValues['begindate']
            := StrToDate(datestr);
            Table1.FieldValues['begintime']
            := StrToTime(timestr);
            Table1.Post;
          end;
     {‘log closed’作为计时的结束}
          if Pos('log closed',str1)< >0 then
          begin
            datestr:=copy(str1,1,10);
            timestr:=copy(str1,12,8);
            table1.Last;
            table1.Edit;
            Table1.FieldValues['enddate'] 
            := StrToDate(datestr);
            Table1.FieldValues['endtime']
            := StrToTime(timestr);
            Table1.Post;
          end;
          Writeln(logbak,str1);
         end;
         Table1.close;
         Rewrite(logfile);
         CloseFile(logfile);
         CloseFile(logbak);
        end;
       end;
      

  5.   

    各位大哥呀!我用的是XP哦!里面没有PPPLOG.txt这个文件呀!
      

  6.   

    我提个建议:
    可以使用定时器,不停的监测当前计算机时不是连入internet,
    就可以取得拨号时间了,
    我记得有个这样的函数,但是忘了,