Projects

Find all our projects in development below.
All source code is GNU General Public License (GPL)

QuickQuery Half-Life Edition

Browsing QuickQuery HL Edition/ProgressForm.frm (7.09 KB)

VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form ProgressForm 
   BorderStyle     =   3  'Fixed Dialog
   ClientHeight    =   495
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3615
   ClipControls    =   0   'False
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "ProgressForm.frx":0000
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   495
   ScaleWidth      =   3615
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.Timer PostLoadTimer 
      Interval        =   1
      Left            =   0
      Top             =   0
   End
   Begin ComctlLib.ProgressBar PBar 
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   3375
      _ExtentX        =   5953
      _ExtentY        =   450
      _Version        =   327682
      Appearance      =   0
      Max             =   22
   End
End
Attribute VB_Name = "ProgressForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Public TaskID As Integer

Private Sub Form_Load()
    EnableX hWnd, False
End Sub


Private Sub PostLoadTimer_Timer()
On Error GoTo ErrHandler
Dim strLine As String
Dim FNum As Integer
Dim TotalServers As Long
Dim LIndex As Long
Dim i As Long
Dim i2 As Long
    PostLoadTimer.Enabled = False
    FNum = FreeFile
    PCount = 0
    If TaskID = 1 Then
        Caption = "Loading Server List..."
        Open Optn_ServerFile For Input As #FNum
            Seek #FNum, LOF(FNum) - 9
            Input #FNum, strLine
            Seek #FNum, 1
            TotalServers = Val(strLine)
            If TotalServers > 0 Then
                i2 = 1
                On Error Resume Next
                Do While Not EOF(FNum)
                    If i2 > TotalServers Then Exit Do
                    Line Input #FNum, strLine
                    If strLine <> "" Then
                        With MainForm.LVServers.ListItems.Add
                            i = 1
                            .Text = Mid(strLine, i, InStr(i + 1, strLine, vbTab) - i)
                            i = InStr(i, strLine, vbTab) + 1
                            .SubItems(1) = Mid(strLine, i, InStr(i + 1, strLine, vbTab) - i)
                            i = InStr(i, strLine, vbTab) + 1
                            .SubItems(2) = Mid(strLine, i, InStr(i + 1, strLine, vbTab) - i)
                            i = InStr(i, strLine, vbTab) + 1
                            .SubItems(3) = Mid(strLine, i, InStr(i + 1, strLine, vbTab) - i)
                            i = InStr(i, strLine, vbTab) + 1
                            .SubItems(4) = Mid(strLine, i, InStr(i + 1, strLine, vbTab) - i)
                            i = InStr(i, strLine, vbTab) + 1
                            .SubItems(5) = Mid(strLine, i, InStr(i + 1, strLine, vbTab) - i)
                            i = InStr(i, strLine, vbTab) + 1
                            .Tag = Mid(strLine, i, InStr(i + 1, strLine, vbTab) - i)
                            i = InStr(i, strLine, vbTab) + 1
                            Select Case LCase(.Tag)
                                Case "action"
                                    .SmallIcon = 7
                                Case "cstrike"
                                    .SmallIcon = 3
                                Case "dmc"
                                    .SmallIcon = 4
                                Case "dod"
                                    .SmallIcon = 5
                                Case "firearms"
                                    .SmallIcon = 6
                                Case "frontline"
                                    .SmallIcon = 8
                                Case "tfc"
                                    .SmallIcon = 2
                                Case "valve"
                                    .SmallIcon = 1
                            End Select
                            .SubItems(6) = Mid(strLine, i, InStr(i + 1, strLine, vbTab) - i)
                            i = InStr(i, strLine, vbTab) + 1
                            .SubItems(7) = Mid(strLine, i, Len(strLine) - i + 1)
                            MainForm.PCount = MainForm.PCount + Val(Left(.SubItems(5), InStr(.SubItems(5), "/") - 1))
                            LIndex = .Index
                        End With
                        SetSubItemText MainForm.LVServers.hWnd, LIndex - 1, 2, CStr(Val(MainForm.LVServers.ListItems(LIndex).SubItems(2)))
                        If Err.Number Then
                            Err.Clear
                            MainForm.PCount = MainForm.PCount - Val(Left(MainForm.LVServers.ListItems(LIndex).SubItems(5), InStr(MainForm.LVServers.ListItems(LIndex).SubItems(5), "/") - 1))
                            MainForm.LVServers.ListItems.Remove LIndex
                        End If
                    End If
                    PBar.Value = Int((i2 / TotalServers) * PBar.Max)
                    i2 = i2 + 1
                Loop
                MainForm.SBar.Panels(1).Text = MainForm.LVServers.ListItems.Count & " Server" + IIf(MainForm.LVServers.ListItems.Count = 1, "", "s")
                MainForm.SBar.Panels(2).Text = MainForm.PCount & " Player" + IIf(PCount = 1, "", "s") + " Online"
                If MainForm.LVServers.ListItems.Count > 0 Then
                    MainForm.UpdateServersMenu.Visible = False
                    MainForm.UpdateServersMenu.Visible = True
                Else
                    MainForm.SBar.Panels(1).Text = "0 Servers (Click Here to Update)"
                End If
            End If
        Close #FNum
    ElseIf TaskID = 2 Then
        Caption = "Saving Server List..."
        Open Optn_ServerFile For Output As #FNum
            For i = 1 To MainForm.LVServers.ListItems.Count
                Print #FNum, MainForm.LVServers.ListItems(i).Text + vbTab + _
                MainForm.LVServers.ListItems(i).SubItems(1) + vbTab + _
                MainForm.LVServers.ListItems(i).SubItems(2) + vbTab + _
                MainForm.LVServers.ListItems(i).SubItems(3) + vbTab + _
                MainForm.LVServers.ListItems(i).SubItems(4) + vbTab + _
                MainForm.LVServers.ListItems(i).SubItems(5) + vbTab + _
                MainForm.LVServers.ListItems(i).Tag + vbTab + _
                MainForm.LVServers.ListItems(i).SubItems(6) + vbTab + _
                MainForm.LVServers.ListItems(i).SubItems(7)
                PBar.Value = Int((i / MainForm.LVServers.ListItems.Count) * PBar.Max)
            Next i
            Print #FNum, String(10 - Len(CStr(i - 1)), "0") & (i - 1);
        Close #FNum
    End If
ErrHandler:
    Unload Me
End Sub


Download QuickQuery HL Edition/ProgressForm.frm

Back to file list


Back to project page