I wrote a program that will take the screenshot of a remote computer screen and send it to me over winsock. The problem is, it tries to display the image before the transfer is complete. On the server side, I have the following code:
keybd_event vbKeySnapshot, 1, 0&, 0&
SavePicture Clipboard.GetData(vbCFBitmap), "c:\sht.bmp"
Dim Efile As String
Open "c:\sht.bmp" For Binary As #1
Efile = Space(LOF(1))
Get #1, 1, Efile
(plus the required function declarations), and on the client side, I have
Open "c:\screenshot.bmp" For Binary As #1
Put #1, , vardata
frmSShot.imgssht.Picture = LoadPicture("c:\screenshot.bmp")
the problem is, when it tries to load the picture, only a small portion of the file is present (4~8kB) out of 275kB or so, so an error occurs. How can I make sure the entire file is transferred and written before displaying the picture?