VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "WinSock Connect to Server"
ClientHeight = 1830
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 4350
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1081.226
ScaleMode = 0 'User
ScaleWidth = 4084.414
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin VB.PictureBox Picture1
BorderStyle = 0 'None
Height = 615
Left = 480
Picture = "frmLogin.frx":0442
ScaleHeight = 615
ScaleWidth = 615
TabIndex = 14
Top = 1200
Width = 615
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 285
Left = 1560
TabIndex = 12
Text = "9843"
Top = 480
Width = 1215
End
Begin VB.TextBox Text1
Height = 285
Left = 1560
TabIndex = 5
Top = 840
Width = 2655
End
Begin VB.TextBox TextIP
Height = 285
Index = 3
Left = 3720
MaxLength = 3
TabIndex = 4
Top = 120
Width = 495
End
Begin VB.TextBox TextIP
Height = 285
Index = 2
Left = 3000
MaxLength = 3
TabIndex = 3
Top = 120
Width = 495
End
Begin VB.TextBox TextIP
Height = 285
Index = 1
Left = 2280
MaxLength = 3
TabIndex = 2
Top = 120
Width = 495
End
Begin VB.TextBox TextIP
Height = 285
Index = 0
Left = 1560
MaxLength = 3
TabIndex = 1
Top = 120
Width = 495
End
Begin VB.CommandButton cmdOK
Caption = "OK"
Default = -1 'True
Height = 390
Left = 1560
TabIndex = 6
Top = 1320
Width = 1140
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "Cancel"
Height = 390
Left = 2880
TabIndex = 7
Top = 1320
Width = 1140
End
Begin VB.Label Label3
Caption = "Server Port"
Height = 255
Left = 120
TabIndex = 13
Top = 480
Width = 1215
End
Begin VB.Label Label2
Caption = "Your Nick Name"
Height = 255
Left = 120
TabIndex = 11
Top = 840
Width = 1215
End
Begin VB.Label Label1
Caption = "."
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 3600
TabIndex = 10
Top = 240
Width = 135
End
Begin VB.Label Label1
Caption = "."
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 2880
TabIndex = 9
Top = 240
Width = 135
End
Begin VB.Label Label1
Caption = "."
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 2160
TabIndex = 8
Top = 240
Width = 135
End
Begin VB.Label lblLabels
Caption = "Server IP Address"
Height = 270
Left = 105
TabIndex = 0
Top = 150
Width = 1320
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public lastIP_Byte1 As Byte
Public lastIP_Byte2 As Byte
Public lastIP_Byte3 As Byte
Public lastIP_Byte4 As Byte
Public settingsValid As Boolean
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim ip As String
Dim i As Long
Dim badFlag As Boolean
Dim nick As String
nick = Text1.text
If (Len(nick) < 3) Then
MsgBox "Bad Nick Name. Minimum 3 characters required.", vbExclamation, "WinSock"
Exit Sub
End If
For i = 0 To 3
If Not (IsNumeric(TextIP(i).text)) Then
badFlag = True
ElseIf (CLng(TextIP(i).text) > 255) Then
badFlag = True
ElseIf (CLng(TextIP(i).text) < 0) Then
badFlag = True
End If
Next i
If (badFlag) Then
MsgBox "Bad IP Address. Try something like that: 127.0.0.1", vbInformation, "WinSock"
Else
ip = TextIP(0).text & "." & _
TextIP(1).text & "." & _
TextIP(2).text & "." & _
TextIP(3).text
Form1.rHostIP = ip
Form1.winSockPort = CLng(Text2.text)
Form1.nickName = nick
lastIP_Byte1 = CByte(TextIP(0).text)
lastIP_Byte2 = CByte(TextIP(1).text)
lastIP_Byte3 = CByte(TextIP(2).text)
lastIP_Byte4 = CByte(TextIP(3).text)
settingsValid = True
Unload Me
End If
End Sub
Private Sub Form_Activate()
TextIP(0).text = lastIP_Byte1
TextIP(1).text = lastIP_Byte2
TextIP(2).text = lastIP_Byte3
TextIP(3).text = lastIP_Byte4
Text1.text = Form1.nickName
Text2.text = CStr(Form1.winSockPort)
settingsValid = False
TextIP(0).SetFocus
End Sub
Private Sub Picture1_Click()
Static count As Long
Select Case count
Case 0:
Text1.text = "Hail To The MosFAT-Crew"
Case 1:
Text1.text = "bnek"
Case 2:
Text1.text = "fatbas"
Case 3:
Text1.text = "locke"
Case 4:
Text1.text = "hans"
Case 5:
Text1.text = "heidi"
count = -1
End Select
count = count + 1
End Sub
Private Sub TextIP_Change(index As Integer)
If (index < 3) Then
If (Len(TextIP(index).text) > 2) Then
TextIP(index + 1).SetFocus
End If
End If
End Sub
Private Sub TextIP_GotFocus(index As Integer)
TextIP(index).SelStart = 0
TextIP(index).SelLength = Len(TextIP(index))
End Sub