Gharibe Posted July 18, 2014 Share Posted July 18, 2014 How To Make Remote Desktop With Vb.Net This is the hidden content, please Sign In or Sign Up Download Video [HIDE-THANKS] This is the hidden content, please Sign In or Sign Up [/HIDE-THANKS] Code You Need [HIDE-THANKS] Imports System.Net.Sockets Imports System.Threading Imports System.Drawing Imports System.Runtime.Serialization.Formatters.Binary Public Class Form2 Dim client As New TcpClient Dim port As Integer Dim server As TcpListener Dim ns As NetworkStream Dim listening As New Thread(AddressOf listen) Dim getimage As New Thread(AddressOf ReceiveImage) Private Sub ReceiveImage() Dim bf As New BinaryFormatter While client.Connected = True ns = client.GetStream PictureBox1.Image = bf.Deserialize(ns) End While End Sub Private Sub listen() While client.Connected = False server.Start() client = server.AcceptTcpClient End While getimage.Start() End Sub Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load port = Integer.Parse(Form1.TextBox1.Text) server = New TcpListener(port) listening.Start() End Sub Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click End Sub End Class This is the hidden content, please Sign In or Sign Up Imports System.Net.Sockets Imports System.Threading Imports System.Drawing Imports System.Runtime.Serialization.Formatters.Binary Public Class Form1 Dim client As New TcpClient Dim ns As NetworkStream Dim port As Integer Public Function Desktop() As Image Dim bounds As Rectangle = Nothing Dim screenhost As System.Drawing.Bitmap = Nothing Dim graph As Graphics = Nothing bounds = Screen.PrimaryScreen.Bounds screenhost = New Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb) graph = Graphics.FromImage(screenhost) graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy) Return screenhost End Function Private Sub sendDesktop() Dim bf As New BinaryFormatter ns = client.GetStream bf.Serialize(ns, Desktop) End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click port = Integer.Parse(TextBox2.Text) Try client.Connect(TextBox1.Text, port) MsgBox("client connected 1") Catch ex As Exception MsgBox("Failed to connect ...") End Try End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Timer1.Start() End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick sendDesktop() End Sub End Class This is the hidden content, please Sign In or Sign Up [/HIDE-THANKS] Link to comment Share on other sites More sharing options...
Recommended Posts