1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67:
| If client1.socket.connected then begin try PicturePath := ExtractFileDir(ParamStr(0)) + '\' + Client1.Host + '_Screen.bmp'; if FileExists (PicturePath) then DeleteFile(PicturePath); Stream := TFileStream.Create(PicturePath,fmCreate); Size := Client1.Socket.ReadInteger; idStream := TiDStreamVCL.Create(Stream,false); Client1.Socket.ReadStream(idStream,Size,False); FreeAndNil(Stream);
With MyBitmapHeader do Begin bfType1 := $42; bfType2 := $4D; bfSize := $00000000; bfReserved1 := $0000; bfReserved2 := $0000; bfOffBits := $36; biSize := $28; biWidth := 640; biHeight := 480; biPlanes := 1; biBitCount := 8; biCompression := $00000000; biSizeImage := $00000000; biXPelsPerMeter := $00000000; biYPelsPerMeter := $00000000; biClrUsed := 180; biClrImportant := 180; end;
if FileExists (dImage) then DeleteFile (dImage); AssignFile(MyFile, dImage); Rewrite(MyFile,1);
BlockWrite (MyFile, MyBitmapHeader, SizeOf(TBmpHeader)); assignfile(srcfile,PicturePath); Reset(srcfile,1);
for i:= 1 to 640 do begin for j:= 1 to 480 do begin if not EOF(SrcFile) then begin BlockRead(Srcfile,SrcBuff,1); BlockWrite(MyFile, SrcBuff,1); end; end; end; CloseFile(srcFile); CloseFile(MyFile); RefreshImage(Client.Host, dImage); finally Stream.Free; end; |