Advertisement
SuperMonkey

Client

Jul 3rd, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.IO
  2. Imports System.Net
  3. Imports System.Net.Sockets
  4. Imports System.Threading
  5. Imports System.Drawing
  6. Imports System.Runtime.Serialization.Formatters.Binary
  7.  
  8. Public Class Form1
  9.  
  10.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  11.         Timer1.Stop()
  12.     End Sub
  13.  
  14.     Dim client As New TcpClient
  15.     Dim nstream As NetworkStream
  16.  
  17.     Public Function Desktop() As Image
  18.         Dim bounds As Rectangle = Nothing
  19.         Dim screenshot As System.Drawing.Bitmap = Nothing
  20.         Dim graph As Graphics = Nothing
  21.         bounds = Screen.PrimaryScreen.Bounds
  22.         screenshot = New Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
  23.         graph = Graphics.FromImage(screenshot)
  24.         graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
  25.         Return screenshot
  26.     End Function
  27.  
  28.     Private Sub SendImage()
  29.         Dim bf As New BinaryFormatter
  30.         nstream = client.GetStream
  31.         bf.Serialize(nstream, Desktop())
  32.     End Sub
  33.  
  34.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  35.         SendImage()
  36.     End Sub
  37.  
  38.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  39.         Try
  40.             client.Connect("24.122.231.246", 8085)
  41.         Catch ex As Exception
  42.             MsgBox("Impossible de se connecter...")
  43.         End Try
  44.     End Sub
  45.  
  46.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  47.         Timer1.Interval = TextBox1.Text
  48.         Timer1.Start()
  49.     End Sub
  50. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement