Can anyone give example of using sockets to send file?
I need to create two programs:
- Server
- Client
The server sends request to client, then the client receives request and captures the screen using this function:
function GetScreenShot(PixelFormat:TPixelFormat;Width,Height:Integer): TBitmap;
var
Desktop: HDC;
begin
Result := TBitmap.Create;
Desktop := GetDC(GetDesktopWindow);
try
try
Result.PixelFormat := PixelFormat;
Result.Width := Width;
Result.Height := Height;
BitBlt(Result.Canvas.Handle, 0, 0, Result.Width, Result.Height, Desktop, 0, 0, SRCCOPY);
Result.Modified := True;
finally
ReleaseDC(0, Desktop);
end;
开发者_开发知识库except
Result.Free;
Result := nil;
end;
end;
After that client sends bitmap to server.
Can someone help me?
Edited to add:
I have some examples:
- This works
- This works too
- C++ and Delphi
have you tried this example http://delphi.about.com/od/internetintranet/l/aa012004a.htm ?
精彩评论