Good day dreamincoders
This is my PROJECT, its a Lan Chat Program where i can send and receive messages from Server to Client and Client to Server.
Please its not a SPYWARE, its totally a LAN CHAT PROGRAM PROJECT. i dont have any bad intent or whatsoever for doing this program. Mods and Seniors i hope you understand me thanks.
This Capture Dekstop Screenshot is a feature for the server where it can get a screenshot of what the client doing, its like a monitoring, while the client will receive a message "Taking a Shot" and capture its screen and sends the image back to the server. Please Seniors and Mods, dont misunderstand my LAN CHAT PROGRAM.
here's my problem:
i always get half or 1/3 of the image when i'm taking a screen capture.
heres the code for my server
and heres for my client
the output image attached here is the image i always received in picturebox1 of server. please help me seniors thanks.
![Posted Image]()
Thanks in Advanced
This is my PROJECT, its a Lan Chat Program where i can send and receive messages from Server to Client and Client to Server.
Please its not a SPYWARE, its totally a LAN CHAT PROGRAM PROJECT. i dont have any bad intent or whatsoever for doing this program. Mods and Seniors i hope you understand me thanks.
This Capture Dekstop Screenshot is a feature for the server where it can get a screenshot of what the client doing, its like a monitoring, while the client will receive a message "Taking a Shot" and capture its screen and sends the image back to the server. Please Seniors and Mods, dont misunderstand my LAN CHAT PROGRAM.
here's my problem:
i always get half or 1/3 of the image when i'm taking a screen capture.
heres the code for my server
dim bytedata(100000) as byte
Private Sub OnReceived(ByVal ar As IAsyncResult)
Dim client As Socket = ar.AsyncState
client.EndReceive(ar)
Dim bytesRec As Byte() = bytedata
Dim message As String = System.Text.ASCIIEncoding.ASCII.GetString(bytesRec)
If caps = 1 Then
caps = 0
Dim path As String
path = System.Windows.Forms.Application.StartupPath.ToString() + "\T1.Bmp"
Dim fli As New FileStream(path, FileMode.OpenOrCreate, FileAccess.Write)
fli.Write(bytesRec, 0, bytesRec.Length)
fli.Close()
Dim s As New FileStream(path, FileMode.Open, FileAccess.Read)
PictureBox1.Image = Image.FromStream(s)
s.Close()
End If
Read(message)
'sortDelim()
Array.Clear(bytedata, 0, bytedata.Length)
clientSocket.BeginReceive(bytedata, 0, bytedata.Length, SocketFlags.None, _
New AsyncCallback(AddressOf OnReceived), clientSocket)
clientSocket = ar.AsyncState
and heres for my client
Private Sub capturenow()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
CaptureScreen()
Dim b(10000000) As Byte
Dim path As String
path = System.Windows.Forms.Application.StartupPath.ToString() + "\T1.bmp"
oBackground.Save(path)
Dim fl As New FileStream(path, FileMode.Open, FileAccess.Read)
Dim l As Integer
l = fl.Read(b, 0, fl.Length)
fl.Close()
clientSocket.Send(b, l, SocketFlags.None)
File.Delete(path)
Timer1.Enabled = False
End Sub
Private Sub CaptureScreen()
Dim hSDC, hMDC As Integer
Dim hBMP, hBMPOld As Integer
Dim r As Integer
hSDC = CreateDC("DISPLAY", "", "", "")
hMDC = CreateCompatibleDC(hSDC)
FW = GetDeviceCaps(hSDC, 8)
FH = GetDeviceCaps(hSDC, 10)
hBMP = CreateCompatibleBitmap(hSDC, FW, FH)
hBMPOld = SelectObject(hMDC, hBMP)
r = BitBlt(hMDC, 0, 0, FW, FH, hSDC, 0, 0, 13369376)
hBMP = SelectObject(hMDC, hBMPOld)
r = DeleteDC(hSDC)
r = DeleteDC(hMDC)
oBackground = Image.FromHbitmap(New IntPtr(hBMP))
DeleteObject(hBMP)
End Sub
the output image attached here is the image i always received in picturebox1 of server. please help me seniors thanks.

Thanks in Advanced