home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 5.00 Begin VB.Form frmConnectionInfo BorderStyle = 3 'Fixed Dialog Caption = "Connection information" ClientHeight = 2295 ClientLeft = 45 ClientTop = 330 ClientWidth = 4170 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2295 ScaleWidth = 4170 ShowInTaskbar = 0 'False StartUpPosition = 1 'CenterOwner Tag = "0" Begin VB.CommandButton cmdConnect Caption = "&Connect" Default = -1 'True Height = 375 Left = 1920 TabIndex = 7 Top = 1440 Width = 975 End Begin VB.CommandButton cmdCancel Cancel = -1 'True Caption = "C&ancel" Height = 375 Left = 3000 TabIndex = 8 Top = 1440 Width = 975 End Begin VB.OptionButton optAnonymous Caption = "Anonymous" Height = 255 Left = 240 TabIndex = 4 Top = 1800 Width = 1215 End Begin VB.OptionButton optNormal Caption = "Normal" Height = 255 Left = 240 TabIndex = 3 Top = 1560 Width = 1215 End Begin VB.Frame fraLoginType Caption = "Login Type" Height = 855 Left = 120 TabIndex = 12 Top = 1320 Width = 1695 End Begin VB.TextBox txtPassword Height = 285 IMEMode = 3 'DISABLE Left = 2160 PasswordChar = "*" TabIndex = 6 Top = 960 Width = 1830 End Begin VB.TextBox txtPort Height = 285 Left = 3360 TabIndex = 2 Text = "21" Top = 360 Width = 615 End Begin VB.TextBox txtUserName Height = 285 Left = 120 TabIndex = 5 Top = 960 Width = 1830 End Begin VB.TextBox txtHost Height = 285 Left = 120 TabIndex = 1 Top = 360 Width = 3135 End Begin VB.Label lblPassword Caption = "Password :" Height = 255 Left = 2160 TabIndex = 11 Top = 720 Width = 975 End Begin VB.Label lblPort Caption = "Port :" Height = 255 Left = 3360 TabIndex = 9 Top = 120 Width = 495 End Begin VB.Label lblUserName Caption = "User Name :" Height = 255 Left = 120 TabIndex = 0 Top = 720 Width = 1215 End Begin VB.Label lblHost Caption = "Host Address : " Height = 255 Left = 120 TabIndex = 10 Top = 120 Width = 1215 End Attribute VB_Name = "frmConnectionInfo" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False ' Xceed FTP Library - FTP Client sample application ' Copyright (c) 2000 Xceed Software Inc. ' [FrmConnectionInfo.frm] ' This form module contains code for the "Connection Information" dialog box. ' This file is part of the Xceed FTP Library sample applications. The source ' code in this file is only intended as a supplement to Xceed FTP Library's ' documentation, and is provided "as is", without warranty of any kind, ' either expressed or implied. Option Explicit Dim m_bCancelled As Boolean ' Determines if the "cancel" button has been clicked. ' **************************************************************************** ' Display the connection dialog form with the parameter values provided by ' reference. Change the variables as needed and return True if the user ' clicked the Connect button or False if the user clicked the Cancel button. ' **************************************************************************** Public Function ShowForm(ByRef sAddress As String, ByRef sPort As String, ByRef sUserName As String, ByRef sPassword As String, ByRef bIsAnonymous As Boolean) As Boolean ' Set the bCancelled variable to True by default m_bCancelled = True ' Fill in our connection dialog form's fields from the parameter values txtHost.Text = sAddress If sPort = "" Then txtPort.Text = "21" ' Default port Else txtPort.Text = sPort End If txtUserName.Text = sUserName txtPassword.Text = sPassword If bIsAnonymous Then optAnonymous.Value = True Else optNormal.Value = True End If ' Display the connection dialog as a modal form Call Show(vbModal) ' The above call was a blocking call, which means that the form ' must have been closed (hidden) and therefore the user has clicked ' on either the Connect or the Cancel button. So lets check which ' button was pressed: If m_bCancelled = False Then ' The Connect button was clicked. ' Lets update the variables passed by reference sAddress = Trim$(txtHost.Text) sPort = Trim$(txtPort.Text) sUserName = Trim$(txtUserName.Text) sPassword = Trim$(txtPassword.Text) bIsAnonymous = optAnonymous.Value ShowForm = True ' True return value means Connect button was clicked Else ShowForm = False ' False return value means Cancel button was clicked End If End Function ' **************************************************************************** ' If the cancel button was selected, we do not want to reactivate the controls. ' **************************************************************************** Private Sub cmdCancel_Click() m_bCancelled = True Me.Hide End Sub ' **************************************************************************** ' In this procedure, we will verify the current connection state to make ' sure that we are not already connected. If we are not connected, we then ' call the clsFTP class's ConnectToServer procedure, passing the connection ' information collected by our dialog box. This will connect us to the FTP ' server. ' **************************************************************************** Private Sub cmdConnect_Click() m_bCancelled = False Me.Hide End Sub Private Sub optAnonymous_Click() txtUserName.Enabled = False ' disable username text box txtPassword.Enabled = False ' disable password text box txtUserName.BackColor = &H8000000F ' Set the background color to grey txtPassword.BackColor = &H8000000F ' Set the background color to grey End Sub Private Sub optNormal_Click() txtUserName.Enabled = True 'enable username text box txtPassword.Enabled = True 'enable password text box txtUserName.BackColor = &H80000009 'Set the background color to white txtPassword.BackColor = &H80000009 'Set the background color to white End Sub