Find all our projects in development below.
All source code is GNU General Public License (GPL)
Browsing Client/ConnectForm.frm (5.65 KB)
VERSION 5.00
Begin VB.Form ConnectForm
BorderStyle = 1 'Fixed Single
Caption = "RemoteAmp Client"
ClientHeight = 1245
ClientLeft = 45
ClientTop = 330
ClientWidth = 5535
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "ConnectForm.frx":0000
MaxButton = 0 'False
ScaleHeight = 1245
ScaleWidth = 5535
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Command1
Caption = "&Connect"
Default = -1 'True
Enabled = 0 'False
Height = 375
Left = 3840
TabIndex = 4
ToolTipText = "Connect to remote host or ip address"
Top = 240
Width = 1455
End
Begin VB.TextBox Text1
Height = 315
IMEMode = 3 'DISABLE
Left = 1200
MaxLength = 50
PasswordChar = "*"
TabIndex = 3
Top = 480
Width = 2415
End
Begin VB.ComboBox Combo1
Height = 315
Left = 1200
TabIndex = 1
ToolTipText = "Enter a remote host or an ip address"
Top = 120
Width = 2415
End
Begin VB.Label StatusLabel
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "Ready to connect."
Height = 255
Left = 120
TabIndex = 5
ToolTipText = "Status: Ready to connect."
Top = 960
Width = 5295
End
Begin VB.Label Label2
Caption = "&Password:"
Height = 255
Left = 120
TabIndex = 2
Top = 560
Width = 855
End
Begin VB.Label Label1
Caption = "&Remote Host:"
Height = 255
Left = 120
TabIndex = 0
Top = 160
Width = 1095
End
End
Attribute VB_Name = "ConnectForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim bNoAlert As Boolean
Private Const AppRegRoot = "Software\RemoteAmp\Client\"
Public Sub ResetCmdBtn()
bNoAlert = True
Command1_Click
bNoAlert = False
End Sub
Private Sub Combo1_Change()
If Combo1.Text = "" Then
Command1.Enabled = False
Else
Command1.Enabled = True
End If
End Sub
Private Sub Combo1_Click()
Combo1_Change
End Sub
Private Sub Command1_Click()
On Error GoTo ErrorHandler
MainForm.Winsck.Close
If Command1.Caption = "&Connect" Then
Dim sckHost As String, sckPort As Integer
StatusLabel.Caption = "Connecting to: " & Combo1.Text & "..."
Combo1.Enabled = False
Text1.Enabled = False
Command1.Caption = "Cancel"
Command1.Cancel = True
Command1.ToolTipText = ""
sckHost = Combo1.Text
If InStr(sckHost, ":") Then
sckPort = Val(Mid(sckHost, InStr(sckHost, ":") + 1))
sckHost = Left(sckHost, InStr(sckHost, ":") - 1)
If sckPort < 1 Then sckPort = 20777
Else
sckPort = 20777
End If
MainForm.Winsck.Connect sckHost, sckPort
ElseIf Command1.Caption = "Cancel" Then
If Not bNoAlert Then MsgBox "Cancelled connection attempt to " & Combo1.Text, vbExclamation
StatusLabel.Caption = "Ready to connect."
Combo1.Enabled = True
Text1.Enabled = True
Command1.Caption = "&Connect"
Command1.Cancel = False
Command1.ToolTipText = "Connect to remote host or ip address"
End If
Exit Sub
ErrorHandler:
MsgBox "Error: " + Err.Description, vbExclamation
If Err.Number = 10049 Then
StatusLabel.Caption = "Ready to connect."
Combo1.Enabled = True
Text1.Enabled = True
Command1.Caption = "&Connect"
Command1.Cancel = False
Command1.ToolTipText = "Connect to remote host or ip address"
End If
End Sub
Private Sub Form_Load()
Dim RegData As String
Dim i As Integer
RegData = GetRegString(HKEY_LOCAL_MACHINE, AppRegRoot, "TotalAddresses")
If Val(RegData) > 0 Then
For i = 1 To Val(RegData)
If GetRegString(HKEY_LOCAL_MACHINE, AppRegRoot, "Address[" & i & "]") <> "" Then
Combo1.AddItem GetRegString(HKEY_LOCAL_MACHINE, AppRegRoot, "Address[" & i & "]")
End If
Next i
End If
Load MainForm
bNoAlert = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode < 2 Then
Dim i As Integer
SaveRegString HKEY_LOCAL_MACHINE, AppRegRoot, "TotalAddresses", CStr(Combo1.ListCount)
If Combo1.ListCount > 0 Then
For i = 0 To Combo1.ListCount - 1
SaveRegString HKEY_LOCAL_MACHINE, AppRegRoot, "Address[" & (i + 1) & "]", Combo1.List(i)
Next i
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub StatusLabel_Change()
StatusLabel.ToolTipText = "Status: " + StatusLabel.Caption
End Sub
Download Client/ConnectForm.frm