home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
- Begin VB.Form frmCLient
- BorderStyle = 4 'Fixed ToolWindow
- Caption = "Client"
- ClientHeight = 2895
- ClientLeft = 1560
- ClientTop = 1710
- ClientWidth = 7230
- Icon = "Form1.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2895
- ScaleWidth = 7230
- ShowInTaskbar = 0 'False
- Begin VB.CommandButton cmdRetract
- Caption = "&Retract"
- Height = 375
- Left = 6120
- TabIndex = 7
- Top = 4920
- Width = 975
- End
- Begin VB.TextBox Text1
- Height = 1815
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 6
- Top = 3000
- Width = 6975
- End
- Begin VB.CommandButton cmdExit
- Caption = "E&xit"
- Height = 375
- Left = 6120
- TabIndex = 5
- Top = 2400
- Width = 975
- End
- Begin VB.Frame Frame1
- Caption = "Tasks"
- Height = 2295
- Left = 120
- TabIndex = 0
- Top = 0
- Width = 6975
- Begin VB.PictureBox Picture1
- Height = 1935
- Left = 1920
- ScaleHeight = 1875
- ScaleWidth = 4875
- TabIndex = 11
- Top = 240
- Visible = 0 'False
- Width = 4935
- Begin VB.CommandButton cmdHide
- Caption = "&Hide"
- Height = 375
- Left = 3840
- TabIndex = 30
- Top = 1440
- Width = 855
- End
- Begin VB.Label Label
- BorderStyle = 1 'Fixed Single
- Height = 255
- Index = 8
- Left = 3360
- TabIndex = 29
- Top = 1080
- Width = 1335
- End
- Begin VB.Label Label
- BorderStyle = 1 'Fixed Single
- Height = 255
- Index = 7
- Left = 3600
- TabIndex = 28
- Top = 600
- Width = 1095
- End
- Begin VB.Label Label
- BorderStyle = 1 'Fixed Single
- Height = 255
- Index = 6
- Left = 3480
- TabIndex = 27
- Top = 120
- Width = 1215
- End
- Begin VB.Label Label
- BorderStyle = 1 'Fixed Single
- Height = 255
- Index = 5
- Left = 1200
- TabIndex = 26
- Top = 1560
- Width = 1455
- End
- Begin VB.Label Label
- BorderStyle = 1 'Fixed Single
- Height = 255
- Index = 4
- Left = 1200
- TabIndex = 25
- Top = 1320
- Width = 1455
- End
- Begin VB.Label Label
- BorderStyle = 1 'Fixed Single
- Height = 255
- Index = 3
- Left = 1200
- TabIndex = 24
- Top = 1080
- Width = 1455
- End
- Begin VB.Label Label
- BorderStyle = 1 'Fixed Single
- Height = 255
- Index = 2
- Left = 1200
- TabIndex = 23
- Top = 840
- Width = 1455
- End
- Begin VB.Label Label
- BorderStyle = 1 'Fixed Single
- Height = 255
- Index = 1
- Left = 1200
- TabIndex = 22
- Top = 360
- Width = 1455
- End
- Begin VB.Label Label
- BorderStyle = 1 'Fixed Single
- Height = 255
- Index = 0
- Left = 1200
- TabIndex = 21
- Top = 120
- Width = 1455
- End
- Begin VB.Label LabelCap
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Total RAM"
- Height = 195
- Index = 8
- Left = 120
- TabIndex = 20
- Top = 1080
- Width = 765
- End
- Begin VB.Label LabelCap
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Memory Load"
- Height = 195
- Index = 7
- Left = 120
- TabIndex = 19
- Top = 840
- Width = 960
- End
- Begin VB.Label LabelCap
- BackStyle = 0 'Transparent
- Caption = "Available Virtual Ram"
- Height = 555
- Index = 6
- Left = 2760
- TabIndex = 18
- Top = 840
- Width = 780
- End
- Begin VB.Label LabelCap
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Virtual Ram"
- Height = 195
- Index = 5
- Left = 2760
- TabIndex = 17
- Top = 600
- Width = 810
- End
- Begin VB.Label LabelCap
- BackStyle = 0 'Transparent
- Caption = "Available PageFile"
- Height = 435
- Index = 4
- Left = 2760
- TabIndex = 16
- Top = 120
- Width = 825
- End
- Begin VB.Label LabelCap
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "PageFile"
- Height = 195
- Index = 3
- Left = 120
- TabIndex = 15
- Top = 1560
- Width = 615
- End
- Begin VB.Label LabelCap
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Avaliable RAM"
- Height = 195
- Index = 2
- Left = 120
- TabIndex = 14
- Top = 1320
- Width = 1050
- End
- Begin VB.Label LabelCap
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Sys Directory:"
- Height = 195
- Index = 1
- Left = 120
- TabIndex = 13
- Top = 360
- Width = 975
- End
- Begin VB.Label LabelCap
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Win Directory:"
- Height = 195
- Index = 0
- Left = 120
- TabIndex = 12
- Top = 120
- Width = 1005
- End
- End
- Begin VB.ListBox List1
- Height = 1620
- Left = 2040
- TabIndex = 4
- Top = 480
- Width = 4815
- End
- Begin VB.CommandButton cmdSysInfo
- Caption = "Retrieve Sys Info"
- Enabled = 0 'False
- Height = 375
- Left = 240
- TabIndex = 3
- Top = 1320
- Width = 1575
- End
- Begin VB.CommandButton cmdRetrieve
- Caption = "Retrieve File Paths"
- Enabled = 0 'False
- Height = 375
- Left = 240
- TabIndex = 2
- Top = 840
- Width = 1575
- End
- Begin VB.CommandButton cmdMsg
- Caption = "Custom Message"
- Enabled = 0 'False
- Height = 375
- Left = 240
- TabIndex = 1
- Top = 360
- Width = 1575
- End
- Begin VB.Label lblFileCnt
- AutoSize = -1 'True
- Caption = "Total Files:"
- Height = 195
- Left = 4200
- TabIndex = 10
- Top = 240
- Visible = 0 'False
- Width = 765
- End
- Begin VB.Label lblCap
- AutoSize = -1 'True
- Caption = "File Paths:"
- Enabled = 0 'False
- Height = 195
- Left = 2040
- TabIndex = 9
- Top = 240
- Width = 735
- End
- End
- Begin MSWinsockLib.Winsock tcpClient
- Left = 5640
- Top = 240
- _ExtentX = 741
- _ExtentY = 741
- _Version = 393216
- End
- Begin VB.Label lblCurCaption
- BorderStyle = 1 'Fixed Single
- Caption = "Waiting for commmand....."
- Height = 255
- Left = 240
- TabIndex = 8
- Top = 2400
- Width = 5685
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuConnect
- Caption = "&Connect"
- End
- Begin VB.Menu mnuDis
- Caption = "&Disconnect"
- End
- Begin VB.Menu mnuSep2
- Caption = "-"
- End
- Begin VB.Menu mnuAbout
- Caption = "&About"
- End
- Begin VB.Menu mnuSep1
- Caption = "-"
- End
- Begin VB.Menu mnuExit
- Caption = "E&xit"
- End
- End
- Attribute VB_Name = "frmCLient"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private WithEvents HostMessages As cClientActions
- Attribute HostMessages.VB_VarHelpID = -1
- Private ChnkCnt As Long
- Private Const About As String = _
- " This project is a tutorial designed to introduce VB Programmers " _
- & "to an easy method of string transfer using the winsock control between " _
- & "client and server applications. It will enable you to pass a command " _
- & "and as many different strings of info as desired back and forth, then " _
- & "seperate these bits of data into their appropriate destination. I will also " _
- & "demonstrate ONE of many methods of retrieving the file paths of the host computer " _
- & " as well as the host SysInfo." & vbCrLf & vbCrLf _
- & " This application is totally object oriented." _
- & " All winsock actions are handled from within several class modules. These ""Objects""" _
- & " will give you the basic template for a very effecient Client\Server System."
- Private Sub cmdHide_Click()
- Picture1.Visible = False
- End Sub
- '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ' * E V E N T P R O C E D U R E S *
- '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Private Sub HostMessages_SysInfoArrival()
- ' the sytem Info has been sent in a packaged form
- ' that must be dis-assembled before the proper usage
- ' can be obtained
- ' the output will be displayed on a blank form
- DisplayInfo Client_.Packaged_SysInfo
- End Sub
- Private Sub HostMessages_TransferDone()
- StatusReport "Transfer Complete."
- Screen.MousePointer = 0
- ' Pause 1 sec
- Pause 1000
- StatusReport "Waiting for command...."
- DoCntrls True
- FileCount True
- End Sub
- Private Sub HostMessages_ConnMade()
- ' connection made... so unload this form
- Unload frmIP
- DoCntrls True
- mnuConnect.Enabled = False
- StatusReport "Connected to " & Client_.IPAddress
- End Sub
- Private Sub HostMessages_IncomingDataChunk()
- ' update the list box with the data
- UpdateListBox List1, Client_.FilePath
- ChnkCnt = ChnkCnt + 1
- StatusReport "Recieving Data Chunk #" & ChnkCnt
- End Sub
- Private Sub HostMessages_DriveInputError()
- Screen.MousePointer = 0
- DoCntrls True
- StatusReport "Waiting for command...."
- End Sub
- '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ' S U B S
- '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Private Sub cmdMsg_Click()
- Client_.SendMsg tcpClient
- End Sub
- Private Sub cmdSysInfo_Click()
- '
- List1.Clear
- FileCount False
- StatusReport _
- "Retrieving system information on host computer."
- If (Not SendData("SysInfo,")) Then
- tcpClient.Close
- End If
- End Sub
- Private Sub cmdRetrieve_Click()
- List1.Clear
-
- ' reset the chunk count
- ChnkCnt = 0
- FileCount False
- Client_.NumFiles = 0
- Client_.CurDrive = ""
- DoCntrls False
- Screen.MousePointer = vbHourglass
- Client_.GetUsersFiles tcpClient
- StatusReport "Querying host for file paths on drive " & Left(Client_.CurDrive, 1)
- End Sub
- Private Sub cmdExit_Click()
- Unload Me
- End Sub
- Private Sub cmdRetract_Click()
- Me.Height = 3510
- End Sub
- Private Sub Form_Load()
- bReplied = False
- ' reference the global object, "Client_"
- ' so that when the ConnMade Event is raised it can be
- ' handled privately in this module.
- Set HostMessages = Client_
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- ' release objects and the RAM they contain
- Set HostMessages = Nothing
- Set Client_ = Nothing
- End
- End Sub
- Private Sub mnuConnect_Click()
- frmIP.Show
- End Sub
- Private Sub mnuDis_Click()
- StatusReport "Connection Closed"
- List1.Clear
- FileCount False
- DoCntrls False
- mnuConnect.Enabled = True
- Client_.DisConnect tcpClient
- End Sub
- Private Sub mnuAbout_Click()
- '
- ' Expand the form
- '
- Me.Height = 6030
- Text1.FontSize = 10
- Text1 = About
- End Sub
- Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long)
- Dim sIncoming As String
- tcpClient.GetData sIncoming
- '--- send the data to be evaluated
- ' if the divider is @ and the command is sysinfo
- ' let eval data know to use a different divide.
- If Client_.EvalData(sIncoming, 1, "@") = "SysInfo" Then
- Client_.HandleIncomingData sIncoming, tcpClient, "@"
- Else
- Client_.HandleIncomingData sIncoming, tcpClient, ","
- End If
- End Sub
-