Results 1 to 5 of 5

Thread: [RESOLVED] lol ***

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    294

    Resolved [RESOLVED] lol ***



    Umm, yeah... no idea why its writing the text on the form like that.

    Here is the timer that must be doing it
    VB Code:
    1. Private Sub TCalcBandwidth_Timer()
    2.     Dim InOctets As Long
    3.     Dim OutOctets As Long
    4.     Dim i As Integer
    5.     Dim Binary As String
    6.     Dim BinarySplit() As String
    7.     Dim BinarySplitSplit() As String
    8.    
    9.     GetNetStats InOctets, OutOctets
    10.    
    11.     If Received <> 0 And Sent <> 0 Then
    12.         LDownload.Caption = Replace(Settings.Load("TDownloadFormat"), "%u", InOctets - Received)
    13.         LUpload.Caption = Replace(Settings.Load("TUploadFormat"), "%u", OutOctets - Sent)
    14.        
    15.         If Len(Dir(App.Path & "\db\", vbDirectory)) = 0 Then
    16.             MkDir App.Path & "\db\"
    17.         End If
    18.  
    19.         i = FreeFile
    20.         Open App.Path & "\db\Current" For Output As i
    21.             Print i, (InOctets - Received) & Chr(2) & (OutOctets - Sent)
    22.         Close i
    23.  
    24.         If HistoryCount = UBound(History) Then
    25.             For i = 1 To UBound(History)
    26.                 History(i - 1) = History(i)
    27.             Next
    28.         Else
    29.             HistoryCount = HistoryCount + 1
    30.         End If
    31.         History(HistoryCount) = (InOctets - Received) & Chr(2) & (OutOctets - Sent)
    32.         i = FreeFile
    33.         Open App.Path & "\db\History" For Output As i
    34.             Print i, Join(History, Chr(1))
    35.         Close i
    36.  
    37.         If Len(Dir(App.Path & "\db\" & Year(Date), vbDirectory)) = 0 Then
    38.             MkDir App.Path & "\db\" & Year(Date)
    39.         End If
    40.         Binary = ReadFile(App.Path & "\db\" & Year(Date) & "\" & StringMonth)
    41.         If InStr(Binary, Day(Date)) = 0 Then
    42.             Binary = IIf(Len(Binary) > 0, Binary & Chr(1), "") & Day(Date) & Chr(2) & (InOctets - Received) & Chr(2) & (OutOctets - Sent)
    43.         Else
    44.             BinarySplit = Split(Binary, Chr(1))
    45.             For i = 0 To UBound(BinarySplit)
    46.                 BinarySplitSplit = Split(BinarySplit(i), Chr(2))
    47.                 If BinarySplitSplit(0) = Day(Date) Then
    48.                     BinarySplitSplit(1) = Int(BinarySplitSplit(1)) + (InOctets - Received)
    49.                     BinarySplitSplit(2) = Int(BinarySplitSplit(2)) + (OutOctets - Sent)
    50.                     BinarySplit(i) = Join(BinarySplitSplit, Chr(2))
    51.                 End If
    52.             Next
    53.             Binary = Join(BinarySplit, Chr(1))
    54.         End If
    55.         i = FreeFile
    56.         Open App.Path & "\db\" & Year(Date) & "\" & StringMonth For Binary As i
    57.             Put i, , Binary
    58.         Close i
    59.     End If
    60.    
    61.     Received = InOctets
    62.     Sent = OutOctets
    63. End Sub
    Attached Images Attached Images  

  2. #2
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    Re: lol ***

    wat s this about?
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  3. #3
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: lol ***

    what you expect from the code?
    could not understand from the code you provided

  4. #4
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    Re: lol ***

    i dont hink he's expecting anything at all, i think he's trying to solve it
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  5. #5
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: lol ***

    This may help

    VB Code:
    1. Private Sub TCalcBandwidth_Timer()
    2.     Dim InOctets As Long
    3.     Dim OutOctets As Long
    4.     Dim i As Integer
    5.     Dim Binary As String
    6.     Dim BinarySplit() As String
    7.     Dim BinarySplitSplit() As String
    8.    
    9.     GetNetStats InOctets, OutOctets
    10.    
    11.     If Received <> 0 And Sent <> 0 Then
    12.         LDownload.Caption = Replace(Settings.Load("TDownloadFormat"), "%u", InOctets - Received)
    13.         LUpload.Caption = Replace(Settings.Load("TUploadFormat"), "%u", OutOctets - Sent)
    14.        
    15.         If Len(Dir(App.Path & "\db\", vbDirectory)) = 0 Then
    16.             MkDir App.Path & "\db\"
    17.         End If
    18.  
    19.         i = FreeFile
    20.         Open App.Path & "\db\Current" For Output As [B]#[/B]i
    21.             Print [B]#[/B]i, (InOctets - Received) & Chr(2) & (OutOctets - Sent)
    22.         Close [B]#[/B]i
    23.  
    24.         If HistoryCount = UBound(History) Then
    25.             For i = 1 To UBound(History)
    26.                 History(i - 1) = History(i)
    27.             Next
    28.         Else
    29.             HistoryCount = HistoryCount + 1
    30.         End If
    31.         History(HistoryCount) = (InOctets - Received) & Chr(2) & (OutOctets - Sent)
    32.         i = FreeFile
    33.         Open App.Path & "\db\History" For Output As [B]#[/B]i
    34.             Print [B]#[/B]i, Join(History, Chr(1))
    35.         Close [B]#[/B]i
    36.  
    37.         If Len(Dir(App.Path & "\db\" & Year(Date), vbDirectory)) = 0 Then
    38.             MkDir App.Path & "\db\" & Year(Date)
    39.         End If
    40.         Binary = ReadFile(App.Path & "\db\" & Year(Date) & "\" & StringMonth)
    41.         If InStr(Binary, Day(Date)) = 0 Then
    42.             Binary = IIf(Len(Binary) > 0, Binary & Chr(1), "") & Day(Date) & Chr(2) & (InOctets - Received) & Chr(2) & (OutOctets - Sent)
    43.         Else
    44.             BinarySplit = Split(Binary, Chr(1))
    45.             For i = 0 To UBound(BinarySplit)
    46.                 BinarySplitSplit = Split(BinarySplit(i), Chr(2))
    47.                 If BinarySplitSplit(0) = Day(Date) Then
    48.                     BinarySplitSplit(1) = Int(BinarySplitSplit(1)) + (InOctets - Received)
    49.                     BinarySplitSplit(2) = Int(BinarySplitSplit(2)) + (OutOctets - Sent)
    50.                     BinarySplit(i) = Join(BinarySplitSplit, Chr(2))
    51.                 End If
    52.             Next
    53.             Binary = Join(BinarySplit, Chr(1))
    54.         End If
    55.         i = FreeFile
    56.         Open App.Path & "\db\" & Year(Date) & "\" & StringMonth For Binary As [B]#[/B]i
    57.             Put [B]#[/B]i, , Binary
    58.         Close [B]#[/B]i
    59.     End If
    60.    
    61.     Received = InOctets
    62.     Sent = OutOctets
    63. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width