Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Imports System.Net
- Imports System.Net.Sockets
- Imports System.Threading
- Imports System.Drawing
- Imports System.Runtime.Serialization.Formatters.Binary
- Public Class Form1
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Timer1.Stop()
- End Sub
- Dim client As New TcpClient
- Dim nstream As NetworkStream
- Public Function Desktop() As Image
- Dim bounds As Rectangle = Nothing
- Dim screenshot As System.Drawing.Bitmap = Nothing
- Dim graph As Graphics = Nothing
- bounds = Screen.PrimaryScreen.Bounds
- screenshot = New Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
- graph = Graphics.FromImage(screenshot)
- graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
- Return screenshot
- End Function
- Private Sub SendImage()
- Dim bf As New BinaryFormatter
- nstream = client.GetStream
- bf.Serialize(nstream, Desktop())
- End Sub
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- SendImage()
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Try
- client.Connect("24.122.231.246", 8085)
- Catch ex As Exception
- MsgBox("Impossible de se connecter...")
- End Try
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Timer1.Interval = TextBox1.Text
- Timer1.Start()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement