home *** CD-ROM | disk | FTP | other *** search
/ Computer Panoráma / computer_panorama_1997-12-hibas.iso / SHARE / NET / TCPCHAT / MAINFORM.FRM < prev    next >
Text File  |  1997-09-05  |  12KB  |  365 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  3. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  4. Begin VB.Form frmMain 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "TCP Chatter"
  7.    ClientHeight    =   5295
  8.    ClientLeft      =   150
  9.    ClientTop       =   435
  10.    ClientWidth     =   7410
  11.    Icon            =   "MainForm.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   5295
  15.    ScaleWidth      =   7410
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin ComctlLib.StatusBar oStatusBar 
  18.       Align           =   2  'Align Bottom
  19.       Height          =   300
  20.       Left            =   0
  21.       TabIndex        =   0
  22.       Top             =   4995
  23.       Width           =   7410
  24.       _ExtentX        =   13070
  25.       _ExtentY        =   529
  26.       SimpleText      =   ""
  27.       _Version        =   327682
  28.       BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
  29.          NumPanels       =   3
  30.          BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  31.             AutoSize        =   2
  32.             Text            =   "IP Address"
  33.             TextSave        =   "IP Address"
  34.             Key             =   ""
  35.             Object.Tag             =   ""
  36.             Object.ToolTipText     =   "This is YOUR IP address"
  37.          EndProperty
  38.          BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  39.             Text            =   "Local Port"
  40.             TextSave        =   "Local Port"
  41.             Key             =   ""
  42.             Object.Tag             =   ""
  43.             Object.ToolTipText     =   "Port on which your system listens for connections."
  44.          EndProperty
  45.          BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  46.             AutoSize        =   1
  47.             Object.Width           =   7885
  48.             Text            =   "Status"
  49.             TextSave        =   "Status"
  50.             Key             =   ""
  51.             Object.Tag             =   ""
  52.             Object.ToolTipText     =   "Current connection status"
  53.          EndProperty
  54.       EndProperty
  55.    End
  56.    Begin VB.Frame Frame1 
  57.       Height          =   2535
  58.       Left            =   120
  59.       TabIndex        =   2
  60.       Top             =   2160
  61.       Width           =   7095
  62.       Begin VB.CommandButton Command1 
  63.          Caption         =   "&About "
  64.          Height          =   375
  65.          Left            =   1560
  66.          TabIndex        =   15
  67.          Top             =   2040
  68.          Width           =   1335
  69.       End
  70.       Begin VB.TextBox edInput 
  71.          Enabled         =   0   'False
  72.          Height          =   285
  73.          Left            =   120
  74.          TabIndex        =   14
  75.          TabStop         =   0   'False
  76.          Top             =   240
  77.          Width           =   5295
  78.       End
  79.       Begin VB.CommandButton btnSend 
  80.          Caption         =   "&Send"
  81.          Default         =   -1  'True
  82.          Enabled         =   0   'False
  83.          Height          =   375
  84.          Left            =   5640
  85.          TabIndex        =   13
  86.          Top             =   240
  87.          Width           =   1335
  88.       End
  89.       Begin VB.CommandButton btnListen 
  90.          Caption         =   "&Listen"
  91.          Height          =   375
  92.          Left            =   120
  93.          TabIndex        =   12
  94.          Top             =   1560
  95.          Width           =   1335
  96.       End
  97.       Begin VB.CommandButton btnDisconnect 
  98.          Caption         =   "&Disconnect"
  99.          Enabled         =   0   'False
  100.          Height          =   375
  101.          Left            =   120
  102.          TabIndex        =   11
  103.          Top             =   2040
  104.          Width           =   1335
  105.       End
  106.       Begin VB.Frame frMode 
  107.          Caption         =   "Mode"
  108.          Height          =   855
  109.          Left            =   120
  110.          TabIndex        =   8
  111.          Top             =   600
  112.          Width           =   1335
  113.          Begin VB.OptionButton opListener 
  114.             Caption         =   "L&istener"
  115.             Height          =   255
  116.             Left            =   120
  117.             TabIndex        =   10
  118.             Top             =   480
  119.             Value           =   -1  'True
  120.             Width           =   975
  121.          End
  122.          Begin VB.OptionButton opCaller 
  123.             Caption         =   "&Caller"
  124.             Height          =   255
  125.             Left            =   120
  126.             TabIndex        =   9
  127.             Top             =   240
  128.             Width           =   855
  129.          End
  130.       End
  131.       Begin VB.Frame frCaller 
  132.          Caption         =   "Caller Settings"
  133.          Height          =   1455
  134.          Left            =   4320
  135.          TabIndex        =   3
  136.          Top             =   960
  137.          Visible         =   0   'False
  138.          Width           =   2655
  139.          Begin VB.TextBox edPort 
  140.             Height          =   285
  141.             Left            =   840
  142.             TabIndex        =   5
  143.             Text            =   "2112"
  144.             Top             =   720
  145.             Width           =   615
  146.          End
  147.          Begin VB.TextBox edAddy 
  148.             Height          =   285
  149.             Left            =   840
  150.             TabIndex        =   4
  151.             Top             =   360
  152.             Width           =   1455
  153.          End
  154.          Begin VB.Label Label2 
  155.             Alignment       =   1  'Right Justify
  156.             Caption         =   "Port:"
  157.             Height          =   255
  158.             Left            =   360
  159.             TabIndex        =   7
  160.             Top             =   720
  161.             Width           =   375
  162.          End
  163.          Begin VB.Label Label1 
  164.             Alignment       =   1  'Right Justify
  165.             Caption         =   "Address:"
  166.             Height          =   255
  167.             Left            =   120
  168.             TabIndex        =   6
  169.             Top             =   360
  170.             Width           =   615
  171.          End
  172.       End
  173.       Begin MSWinsockLib.Winsock oWinSock 
  174.          Left            =   3600
  175.          Top             =   1920
  176.          _ExtentX        =   741
  177.          _ExtentY        =   741
  178.          _Version        =   327681
  179.          LocalPort       =   2112
  180.       End
  181.    End
  182.    Begin VB.TextBox edOutput 
  183.       Height          =   2055
  184.       Left            =   120
  185.       Locked          =   -1  'True
  186.       MultiLine       =   -1  'True
  187.       ScrollBars      =   2  'Vertical
  188.       TabIndex        =   1
  189.       TabStop         =   0   'False
  190.       Top             =   0
  191.       Width           =   7095
  192.    End
  193. End
  194. Attribute VB_Name = "frmMain"
  195. Attribute VB_GlobalNameSpace = False
  196. Attribute VB_Creatable = False
  197. Attribute VB_PredeclaredId = True
  198. Attribute VB_Exposed = False
  199. ' TCP Chatter
  200. ' Copyright 1997 by Shawn Riggins
  201. ' Use this program at your own risk.
  202. ' This program is freeware and you are welcome to use the
  203. ' source code for whatever you want.  Just remember, anything
  204. ' you do with the source code is done at your OWN RISK
  205.  
  206.  
  207. Option Explicit
  208.  
  209. Public Sub btnDisconnect_Click()
  210.     oWinSock.Close
  211.     oStatusBar.Panels.Item(3).Text = "Not Connected"
  212.     
  213.     btnDisconnect.Enabled = False
  214.     btnListen.Enabled = True
  215.     btnSend.Enabled = False
  216.     edInput.Enabled = False
  217.     
  218.     'Enable the mode group
  219.     frMode.Enabled = True
  220.     opCaller.Enabled = True
  221.     opListener.Enabled = True
  222.     
  223.     'Enable caller group
  224.     frCaller.Enabled = True
  225.     edAddy.Enabled = True
  226.     edPort.Enabled = True
  227.     
  228. End Sub
  229.  
  230. Private Sub btnListen_Click()
  231.     'Clear the window
  232.     edOutput.Text = ""
  233.  
  234.     'Make a connection or listen, based on the dialog values
  235.     On Error GoTo ErrorHandler
  236.         If opListener.Value = True Then
  237.             oWinSock.Listen
  238.             oStatusBar.Panels.Item(3).Text = "Listening..."
  239.         Else
  240.             oWinSock.RemotePort = edPort.Text
  241.             oWinSock.Connect (edAddy.Text)
  242.             oStatusBar.Panels.Item