home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 April
/
ChipCD_498.iso
/
software
/
ftp
/
quickftp
/
quickft1.frm
< prev
next >
Wrap
Text File
|
1996-01-30
|
17KB
|
607 lines
VERSION 2.00
Begin Form Connectform
BackColor = &H00C0C0C0&
BorderStyle = 3 'Fixed Double
Caption = "Quick Connect"
ClientHeight = 4395
ClientLeft = 630
ClientTop = 2445
ClientWidth = 8070
ControlBox = 0 'False
ForeColor = &H0000C0C0&
Height = 4800
Left = 570
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4395
ScaleWidth = 8070
Top = 2100
Width = 8190
Begin Frame Frame2
Caption = "Transfer Info"
Height = 1695
Left = 240
TabIndex = 1
Top = 2040
Width = 7575
Begin CheckBox ChkAscii
Caption = "ASCII transfer"
Height = 255
Left = 3000
TabIndex = 3
Top = 1200
Value = 1 'Checked
Width = 1935
End
Begin OptionButton OptGet
Caption = "GET"
Height = 255
Left = 720
TabIndex = 4
Top = 1200
Value = -1 'True
Width = 855
End
Begin OptionButton OptPUT
Caption = "PUT"
Height = 255
Left = 1800
TabIndex = 5
Top = 1200
Width = 855
End
Begin TextBox txtLocalFile
Height = 285
Left = 3720
TabIndex = 6
Top = 720
Width = 3615
End
Begin TextBox txtRemoteFile
Height = 285
Left = 3720
TabIndex = 7
Top = 360
Width = 3615
End
Begin Label Label6
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Local Path (Drive:\Directory\Filename):"
Height = 255
Left = 240
TabIndex = 8
Top = 720
Width = 3375
End
Begin Label Label5
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Host FileName:"
Height = 255
Left = 840
TabIndex = 15
Top = 360
Width = 2775
End
End
Begin Frame Frame3
Caption = "Connection Info"
Height = 1815
Left = 240
TabIndex = 19
Top = 240
Width = 4335
Begin TextBox txtDirect
Height = 285
Left = 1680
TabIndex = 16
Top = 1440
Width = 2535
End
Begin TextBox UserEdit
Height = 285
Left = 1680
TabIndex = 22
Top = 720
Width = 2535
End
Begin TextBox PasswordEdit
Height = 285
Left = 1680
PasswordChar = "*"
TabIndex = 21
Top = 1080
Width = 2535
End
Begin TextBox NodeEdit
Height = 285
Left = 1680
TabIndex = 20
Top = 360
Width = 2535
End
Begin Label Label4
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Initial Directory:"
Height = 255
Left = 120
TabIndex = 17
Top = 1440
Width = 1455
End
Begin Label Label1
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Host Name:"
Height = 255
Left = 240
TabIndex = 18
Top = 360
Width = 1335
End
Begin Label Label2
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Login Name:"
Height = 255
Left = 240
TabIndex = 24
Top = 720
Width = 1335
End
Begin Label Label3
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Password :"
Height = 255
Left = 240
TabIndex = 23
Top = 1080
Width = 1335
End
End
Begin Frame Frame1
Caption = "Connection Sequence"
Height = 1815
Left = 4560
TabIndex = 9
Top = 240
Width = 3255
Begin TextBox txtCycle
Height = 285
Left = 2160
TabIndex = 13
Top = 1320
Visible = 0 'False
Width = 975
End
Begin OptionButton OptLoginOnly
Caption = "Login Only"
Height = 255
Left = 120
TabIndex = 12
Top = 240
Value = -1 'True
Width = 1455
End
Begin OptionButton OptFTPOnly
Caption = "Cycle FTP Only"
Height = 255
Left = 120
TabIndex = 11
Top = 600
Width = 2175
End
Begin OptionButton OptDoitAll
Caption = "Cycle Connect-FTP-Disconnect"
Height = 255
Left = 120
TabIndex = 10
Top = 960
Width = 3015
End
Begin Label lblCycle
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Cycle Time (sec):"
Height = 255
Left = 480
TabIndex = 14
Top = 1320
Visible = 0 'False
Width = 1575
End
End
Begin CommandButton Command2
Cancel = -1 'True
Caption = "&Cancel"
Height = 375
Left = 6840
TabIndex = 2
Top = 3840
Width = 975
End
Begin CommandButton Command1
Caption = "&Login"
Height = 375
Left = 5760
TabIndex = 0
Top = 3840
Width = 975
End
End
Function Check_info () As Integer
'__
'__ Connectform Check_info
'__ called by Connectform command1_click
'__ calls GLOBAL getinput
'__ calls GLOBAL IsValidGet
'__ calls GLOBAL IsValidPut
'__ calls GLOBAL switch_to
'__
'check if Hostname, Userid and password have been defined
'
Dim ok%
Check_info = False
ok% = True
If Len(Trim$(ConnectForm!NodeEdit.Text)) = 0 Then
ConnectForm!NodeEdit = getinput("Host Name", "")
End If
If Len(Trim$(ConnectForm!UserEdit.Text)) = 0 Then
ConnectForm!UserEdit = getinput("Login Name", "anonymous")
End If
If Len(Trim$(ConnectForm!PasswordEdit.Text)) = 0 Then
ConnectForm!PasswordEdit = getinput("Password", "HIDDENVALUE")
End If
If Len(Trim$(ConnectForm!NodeEdit.Text)) = 0 Then
ok% = False
switch_to NodeEdit
ElseIf Len(Trim$(ConnectForm!UserEdit.Text)) = 0 Then
ok% = False
switch_to UserEdit
ElseIf Len(Trim$(ConnectForm!PasswordEdit.Text)) = 0 Then
ok% = False
switch_to PasswordEdit
End If
If Not ok% Then
MsgBox "Need Host Name, Login Name and Password to proceed.", 64
Exit Function
End If
switch_to txtLocalFile
If OptPut And Not OptLoginOnly Then
If Not IsValidPut(txtLocalFile) Then Exit Function
End If
If optGet And Not OptLoginOnly Then
If Not IsValidGet(txtLocalFile) Then Exit Function
End If
Check_info = True
'
End Function
Sub command1_click ()
'__
'__ Connectform command1_click
'__ calls Connectform Check_info
'__ calls Connectform PrivateStrings
'__
'
If Check_info() Then
OkDialog = True
Hostname = ConnectForm!NodeEdit.Text
Userid = ConnectForm!UserEdit.Text
Password = ConnectForm!PasswordEdit.Text
ServerDirect = ConnectForm!txtDirect.Text
Host_File_Name = txtRemoteFile
Local_File_Name = txtLocalFile
doitmode = OptDoItAll
cyclemode = Not OptLoginOnly
putmode = OptPut
If putmode Then
Src_name = txtLocalFile
Dest_name = txtRemoteFile
Else
Src_name = txtRemoteFile
Dest_name = txtLocalFile
End If
TransType = Asc("I")
If chkAscii.Value = 1 Then TransType = Asc("A")
If Not cyclemode Then txtCycle = 0
FTP_Form.Cycle_sec = Val(txtCycle)
Call PrivateStrings(1)
Unload ConnectForm
End If
'
End Sub
Sub Command2_Click ()
'
OkDialog = False
'
Unload ConnectForm
'
End Sub
Sub Form_Load ()
'__
'__ Connectform Form_Load
'__ calls Connectform PrivateStrings
'__ calls GLOBAL switch_to
'__
ConnectForm!PasswordEdit.Text = Password
Call PrivateStrings(0)
switch_to NodeEdit
End Sub
Sub NodeEdit_GotFocus ()
'__
'__ Connectform NodeEdit_GotFocus
'__ calls GLOBAL switch_to
'__
switch_to NodeEdit
End Sub
Sub NodeEdit_KeyPress (keyascii As Integer)
'__
'__ Connectform NodeEdit_KeyPress
'__
'__ parameter keyascii As Integer
'__ calls GLOBAL switch_to
'__
If keyascii = 13 Then keyascii = 0: switch_to UserEdit
End Sub
Sub OptDoitAll_Click ()
'__
'__ Connectform OptDoitAll_Click
'__ calls GLOBAL switch_to
'__
lblCycle.Visible = True
txtCycle.Visible = True
frame2.Visible = True
switch_to txtCycle
End Sub
Sub OptFTPOnly_Click ()
'__
'__ Connectform OptFTPOnly_Click
'__ calls GLOBAL switch_to
'__
lblCycle.Visible = True
txtCycle.Visible = True
frame2.Visible = True
switch_to txtCycle
End Sub
Sub OptLoginOnly_Click ()
lblCycle.Visible = False
txtCycle.Visible = False
frame2.Visible = False
End Sub
Sub PasswordEdit_GotFocus ()
'__
'__ Connectform PasswordEdit_GotFocus
'__ calls GLOBAL switch_to
'__
switch_to PasswordEdit
End Sub
Sub PasswordEdit_KeyPress (keyascii As Integer)
'__
'__ Connectform PasswordEdit_KeyPress
'__
'__ parameter keyascii As Integer
'__ calls GLOBAL switch_to
'__
If keyascii = 13 Then keyascii = 0: switch_to txtDirect
End Sub
Sub PrivateStrings (mode)
'__
'__ Connectform PrivateStrings
'__
'__ parameter mode
'__ called by Connectform command1_click
'__ called by Connectform Form_Load
'__ calls GLOBAL GetPrivateProfileString
'__ calls GLOBAL writePrivateProfileString
'__
Dim prostring As String * 100
INIFILE = app.Path & "\QUICKFTP.INI"
INFILE$ = INIFILE
buffer$ = String$(100, 0)
If mode = 0 Then 'read
id% = GetPrivateProfileString("Variables", "RemoteHost", "", buffer$, 100, INFILE$)
NodeEdit = Left$(buffer$, id%)
id% = GetPrivateProfileString("Variables", "LoginID", "", buffer$, 100, INFILE$)
UserEdit = Left$(buffer$, id%)
id% = GetPrivateProfileString("Variables", "RemoteDirectory", "", buffer$, 100, INFILE$)
txtDirect = Left$(buffer$, id%)
id% = GetPrivateProfileString("Variables", "RemoteFile", "", buffer$, 100, INFILE$)
txtRemoteFile = Left$(buffer$, id%)
id% = GetPrivateProfileString("Variables", "LocalFile", "", buffer$, 100, INFILE$)
txtLocalFile = Left$(buffer$, id%)
id% = GetPrivateProfileString("Variables", "Delay", "40", buffer$, 100, INFILE$)
txtCycle = Val(Left$(buffer$, id%))
id% = GetPrivateProfileString("Variables", "CycleMode", "LOGIN ONLY", buffer$, 100, INFILE$)
OptFTPOnly = (Asc(buffer$) = Asc("F"))
OptLoginOnly = (Asc(buffer$) = Asc("L"))
OptDoItAll = (Asc(buffer$) = Asc("C"))
id% = GetPrivateProfileString("Variables", "TransferMode", "A", buffer$, 100, INFILE$)
chkAscii = -(Left$(buffer$, 1) = "A")
id% = GetPrivateProfileString("Variables", "TransferDirection", "GET", buffer$, 100, INFILE$)
OptPut = (Left$(buffer$, 1) = "P")
Else 'write
prostring = NodeEdit
id% = writePrivateProfileString("Variables", "RemoteHost", prostring, INFILE$)
prostring = UserEdit
id% = writePrivateProfileString("Variables", "LoginID", prostring, INFILE$)
prostring = txtDirect
id% = writePrivateProfileString("Variables", "RemoteDirectory", prostring, INFILE$)
prostring = txtRemoteFile
id% = writePrivateProfileString("Variables", "RemoteFile", prostring, INFILE$)
prostring = txtLocalFile
id% = writePrivateProfileString("Variables", "LocalFile", prostring, INFILE$)
prostring = Format$(Val(txtCycle))
id% = writePrivateProfileString("Variables", "Delay", prostring, INFILE$)
If OptFTPOnly Then
prostring = "FTP ONLY"
ElseIf OptLoginOnly Then
prostring = "LOGIN ONLY"
ElseIf OptDoItAll Then
prostring = "CONNECT-FTP-DISCONNECT"
End If
id% = writePrivateProfileString("Variables", "CycleMode", prostring, INFILE$)
prostring = Chr(TransType)
id% = writePrivateProfileString("Variables", "TransferMode", prostring, INFILE$)
prostring = "GET"
If putmode Then prostring = "PUT"
id% = writePrivateProfileString("Variables", "TransferDirection", prostring, INFILE$)
End If
End Sub
Sub txtCycle_KeyPress (keyascii As Integer)
'__
'__ Connectform txtCycle_KeyPress
'__
'__ parameter keyascii As Integer
'__
If keyascii = 13 Then keyascii = 0: command1.SetFocus
End Sub
Sub txtDirect_GotFocus ()
'__
'__ Connectform txtDirect_GotFocus
'__ calls GLOBAL switch_to
'__
switch_to txtDirect
End Sub
Sub txtDirect_KeyPress (keyascii As Integer)
'__
'__ Connectform txtDirect_KeyPress
'__
'__ parameter keyascii As Integer
'__ calls GLOBAL switch_to
'__
If keyascii = 13 Then keyascii = 0: switch_to txtRemoteFile
End Sub
Sub txtLocalFile_GotFocus ()
'__
'__ Connectform txtLocalFile_GotFocus
'__ calls GLOBAL switch_to
'__
switch_to txtLocalFile
End Sub
Sub txtLocalFile_KeyPress (keyascii As Integer)
'__
'__ Connectform txtLocalFile_KeyPress
'__
'__ parameter keyascii As Integer
'__ calls GLOBAL switch_to
'__
If keyascii = 13 Then keyascii = 0: switch_to txtCycle
End Sub
Sub txtRemoteFile_GotFocus ()
'__
'__ Connectform txtRemoteFile_GotFocus
'__ calls GLOBAL switch_to
'__
switch_to txtRemoteFile
End Sub
Sub txtRemoteFile_KeyPress (keyascii As Integer)
'__
'__ Connectform txtRemoteFile_KeyPress
'__
'__ parameter keyascii As Integer
'__ calls GLOBAL switch_to
'__
If keyascii = 13 Then
keyascii = 0
switch_to txtLocalFile
End If
End Sub
Sub UserEdit_gotfocus ()
'__
'__ Connectform UserEdit_gotfocus
'__ calls GLOBAL switch_to
'__
switch_to UserEdit
End Sub
Sub UserEdit_KeyPress (keyascii As Integer)
'__
'__ Connectform UserEdit_KeyPress
'__
'__ parameter keyascii As Integer
'__ calls GLOBAL switch_to
'__
If keyascii = 13 Then keyascii = 0: switch_to PasswordEdit
End Sub