Find all our projects in development below.
All source code is GNU General Public License (GPL)
Browsing QuickQuery HL Edition/LaunchForm.frm (12.73 KB)
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form LaunchForm
BorderStyle = 3 'Fixed Dialog
Caption = "Launch Half-Life & Connect"
ClientHeight = 1815
ClientLeft = 45
ClientTop = 330
ClientWidth = 5415
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 = "LaunchForm.frx":0000
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1815
ScaleWidth = 5415
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton Command5
Height = 255
Left = 5000
Picture = "LaunchForm.frx":000C
Style = 1 'Graphical
TabIndex = 11
ToolTipText = "Click for command line help"
Top = 870
Width = 300
End
Begin VB.Timer PostLoadTimer
Enabled = 0 'False
Interval = 1500
Left = 480
Top = 0
End
Begin VB.TextBox txtCmdLine
Height = 315
Left = 1800
MaxLength = 300
TabIndex = 10
Top = 840
Width = 3135
End
Begin VB.ListBox lstOptions
Height = 1185
ItemData = "LaunchForm.frx":009B
Left = 120
List = "LaunchForm.frx":00AB
Style = 1 'Checkbox
TabIndex = 3
TabStop = 0 'False
Top = 1920
Width = 5175
End
Begin VB.CommandButton Command4
Caption = "&Options >>"
Height = 375
Left = 4200
TabIndex = 2
Top = 1320
Width = 1095
End
Begin MSComDlg.CommonDialog EXEDialog
Left = 0
Top = 0
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
DialogTitle = "Browse for Half-Life Executable"
Filter = $"LaunchForm.frx":0109
End
Begin VB.CommandButton Command3
Caption = "..."
Height = 255
Left = 5000
Style = 1 'Graphical
TabIndex = 8
ToolTipText = "Browse for Half-Life executable"
Top = 510
Width = 300
End
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "Close"
Height = 375
Left = 3000
TabIndex = 1
Top = 1320
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "&Launch"
Default = -1 'True
Height = 375
Left = 1800
TabIndex = 0
Top = 1320
Width = 1095
End
Begin VB.TextBox txtPath
Height = 315
Left = 1800
MaxLength = 1000
TabIndex = 7
Top = 480
Width = 3135
End
Begin VB.TextBox txtAddress
Height = 315
Left = 1800
MaxLength = 50
TabIndex = 5
Top = 120
Width = 3495
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "&Cmd Line Arguments:"
Height = 255
Left = 120
TabIndex = 9
ToolTipText = "Command Line Arguments"
Top = 900
Width = 1575
End
Begin VB.Image IconImage
Height = 480
Left = 120
Top = 1200
Width = 480
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "&Half-Life Executable:"
Height = 255
Left = 120
TabIndex = 6
Top = 540
Width = 1575
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "&Server Address:"
Height = 255
Left = 120
TabIndex = 4
Top = 180
Width = 1215
End
End
Attribute VB_Name = "LaunchForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public bNoSet As Boolean
Public bHasPassword As Boolean
Public strPassword As String
Public bPasswordCancel As Boolean
Dim OldMSNStatus As Integer
Public Sub ProgTerminated()
On Error Resume Next
Dim MSNObj As Object
Dim i As Long
If lstOptions.Selected(0) And Optn_ClosePB = 1 Then EndPunkBuster
If lstOptions.Selected(2) And Optn_CloseCD = 1 Then EndCD
If lstOptions.Selected(3) And Optn_ResetMSNStatus = 1 And OldMSNStatus > 0 Then
Err.Clear
Set MSNObj = CreateObject("Messenger.MsgrObject")
If Err.Number = 0 Then MSNObj.LocalState = OldMSNStatus
Set MSNObj = Nothing
OldMSNStatus = 0
End If
For i = 1 To UBound(ProgramsList)
If ProgramsList(i).Enabled = True And _
ProgramsList(i).iClose = 1 And _
ProgramsList(i).PID <> 0 Then
EndAdditionalProgram ProgramsList(i).PID
ProgramsList(i).PID = 0
End If
Next i
bIsLaunched = False
End Sub
Private Sub Command1_Click()
On Error Resume Next
Dim MSNObj As Object
Dim strCmdLine As String
Dim i As Long
If lstOptions.Selected(0) = True And _
lstOptions.Selected(1) = True And _
Msg_PBPaladinError = 0 Then
If MsgBox("Warning: It is not recommended to you run both PunkBuster and Paladin simultaneously, do you wish to continue?", vbYesNo + vbExclamation) = vbNo Then Exit Sub
End If
If bHasPassword Then
With ServerPasswordForm
.Text1.Text = strPassword
.Text1.SelStart = 0
.Text1.SelLength = Len(.Text1.Text)
.Show 1
End With
If bPasswordCancel Then Exit Sub
End If
If lstOptions.Selected(0) Then
If RunPunkBuster(LaunchOptn_PBLocation) = 0 And Msg_PBError = 0 Then MsgBox "Unable to run PunkBuster." & vbCrLf & vbCrLf & "Please verify that the path is correct.", vbCritical
End If
If lstOptions.Selected(2) Then
If RunCD(LaunchOptn_CDLocation) = 0 And Msg_CDError = 0 Then MsgBox "Unable to run Cheating-Death." & vbCrLf & vbCrLf & "Please verify that the path is correct.", vbCritical
End If
If lstOptions.Selected(3) Then
Set MSNObj = CreateObject("Messenger.MsgrObject")
If Err.Number And Msg_MSNError = 0 Then
MsgBox "Unable to change MSN Messenger status." & vbCrLf & vbCrLf & "Please verify that MSN Messenger is installed.", vbCritical
Err.Clear
Else
OldMSNStatus = MSNObj.LocalState
Select Case LaunchOptn_MSNStatus
Case 0
MSNObj.LocalState = 10
Case 1
MSNObj.LocalState = 14
Case 2
MSNObj.LocalState = 34
Case 3
MSNObj.LocalState = 50
Case 4
MSNObj.LocalState = 66
Case 5
MSNObj.LogOff
End Select
Set MSNObj = Nothing
End If
End If
For i = 1 To UBound(ProgramsList)
If ProgramsList(i).Enabled = True Then
strCmdLine = Replace(ProgramsList(i).CmdLine, "%address%", txtAddress.Text)
strCmdLine = Replace(strCmdLine, "%game%", Tag)
strCmdLine = Replace(strCmdLine, "%pass%", strPassword)
ProgramsList(i).PID = RunAdditionalProgram(ProgramsList(i).Target, _
strCmdLine, ProgramsList(i).ProcessPriority, _
ProgramsList(i).Path, CVar(ProgramsList(i).RunMode))
Else
ProgramsList(i).PID = 0
End If
Next i
strCmdLine = Replace(txtCmdLine.Text, "%address%", txtAddress.Text)
strCmdLine = Replace(strCmdLine, "%game%", Tag)
strCmdLine = Replace(strCmdLine, "%pass%", strPassword)
If RunProgram(IIf(lstOptions.Selected(1), LaunchOptn_PaladinLocation, txtPath.Text), "-console -game " & Tag & " +connect " & txtAddress.Text & IIf(bHasPassword, " +setinfo ""password"" """ + strPassword + """", "") + IIf(strCmdLine = "", "", " ") + strCmdLine, Optn_ProcessPriority) = 0 Then _
MsgBox "Unable to launch " + IIf(lstOptions.Selected(1), "Paladin (Half-Life).", " Half-Life.") & vbCrLf & vbCrLf & "Please verify that the path is correct.", vbCritical
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
On Error GoTo CancelErr
EXEDialog.Filename = txtPath.Text
EXEDialog.ShowOpen
txtPath.Text = EXEDialog.Filename
txtPath.SetFocus
txtPath.SelStart = 0
txtPath.SelLength = Len(txtPath.Text)
CancelErr:
End Sub
Private Sub Command4_Click()
If Command4.Caption = "&Options >>" Then
Command4.Caption = "&Options <<"
lstOptions.TabStop = True
Height = lstOptions.Top + lstOptions.Height + (Height - ScaleHeight) + 105
Else
Height = lstOptions.Top + (Height - ScaleHeight) - 105
Command4.Caption = "&Options >>"
lstOptions.TabStop = False
End If
End Sub
Private Sub Command5_Click()
MsgBox "Command Line Argument variables:" + vbCrLf + vbCrLf + _
"%address% - Inserts the server's address." + vbCrLf + _
"%game% - Inserts the game type." + vbCrLf + _
"%pass% - Inserts the password the user entered for the server." + vbCrLf + vbCrLf + _
"Note: All variables are case sensative.", vbInformation, _
"Command Line Help"
End Sub
Private Sub Form_Load()
Dim strStatus As String
EXEDialog.flags = cdlOFNOverwritePrompt + cdlOFNLongNames + cdlOFNHideReadOnly
CButton Command3
txtPath.Text = ExecutablePath
txtCmdLine.Text = CmdLineArguments
bNoSet = True
If LaunchOptn_RunPB = 1 Then lstOptions.Selected(0) = True
lstOptions.List(0) = "Run PunkBuster: " + LaunchOptn_PBLocation
If LaunchOptn_RunPaladin = 1 Then lstOptions.Selected(1) = True
lstOptions.List(1) = "Run Paladin: " + LaunchOptn_PaladinLocation
If LaunchOptn_RunCD = 1 Then lstOptions.Selected(2) = True
lstOptions.List(2) = "Run Cheating-Death: " + LaunchOptn_CDLocation
If LaunchOptn_ChangeMSNStatus = 1 Then lstOptions.Selected(3) = True
Select Case LaunchOptn_MSNStatus
Case 0
strStatus = "Busy"
Case 1
strStatus = "Be Right Back"
Case 2
strStatus = "Away"
Case 3
strStatus = "On The Phone"
Case 4
strStatus = "Out To Lunch"
Case 5
strStatus = "Offline"
End Select
lstOptions.List(3) = "Change MSN Messenger status to: " + strStatus
lstOptions.ListIndex = -1
bNoSet = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
ExecutablePath = txtPath.Text
CmdLineArguments = txtCmdLine.Text
LaunchOptn_RunPB = Abs(CInt(lstOptions.Selected(0)))
LaunchOptn_RunPaladin = Abs(CInt(lstOptions.Selected(1)))
LaunchOptn_RunCD = Abs(CInt(lstOptions.Selected(2)))
LaunchOptn_ChangeMSNStatus = Abs(CInt(lstOptions.Selected(3)))
End Sub
Private Sub Form_Unload(Cancel As Integer)
MainForm.SetFocus
End Sub
Private Sub lstOptions_Click()
lstOptions.ListIndex = -1
End Sub
Private Sub lstOptions_ItemCheck(Item As Integer)
If Item >= 0 Then
If lstOptions.Selected(Item) And Not bNoSet Then
Select Case Item
Case 0
PBPathForm.Show 1
Case 1
PaladinPathForm.Show 1
Case 2
CDPathForm.Show 1
Case 3
MSNStatusForm.Show 1
End Select
End If
End If
End Sub
Private Sub PostLoadTimer_Timer()
PostLoadTimer.Enabled = False
Command1_Click
End Sub
Download QuickQuery HL Edition/LaunchForm.frm