兔
兔子帅死了
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure SaveScrToStream(); //屏幕截取函数
var winHWND :integer;
winDC:integer;
rect:TRect;
fBitmap:TBitmap;
begin
winHWND := GetDesktopWindow();
winDC := GetDC(winHWND);
fBitmap := TBitmap.create;
fBitmap.width := screen.Width;
fBitmap.height := screen.Height;
BitBlt(fBitmap.canvas.handle, 0, 0, fBitmap.width, fBitmap.height, winDC, 0, 0, SRCCOPY);
fBitmap.SaveToFile('c:/aa.bmp');
fBitmap.PixelFormat :=pf8bit;
fBitmap.Free;
end;
//连接要做的事
procedure TForm1.CS_Connect(Sender: TObject; Socket: TCustomWinSocket);
begin
m.Position := 0;
socket.SendStream(m);
cs.OnDisconnect:=CS_DisConnect;
end;
//关闭
procedure TForm1.CS_DisConnect(Sender: TObject; Socket: TCustomWinSocket);
begin
(Sender as TClientSocket).socket.close;
end;
//点击按钮发送消息
procedure TForm1.Button1Click(Sender: TObject);
begin
cs:= TClientSocket.Create(nil);
cs.Host:='192.168.0.21';
cs.Port:= 1234;
SaveScrToStream();
m.Free;
m := tfilestream.Create('C:/aa.bmp',fmOpenRead );
cs.OnConnect:= CS_Connect;
cs.Open;
end;
第一次在服务器端已经完整传过去了,第二次的时候出现External exception C0000008的错误
var winHWND :integer;
winDC:integer;
rect:TRect;
fBitmap:TBitmap;
begin
winHWND := GetDesktopWindow();
winDC := GetDC(winHWND);
fBitmap := TBitmap.create;
fBitmap.width := screen.Width;
fBitmap.height := screen.Height;
BitBlt(fBitmap.canvas.handle, 0, 0, fBitmap.width, fBitmap.height, winDC, 0, 0, SRCCOPY);
fBitmap.SaveToFile('c:/aa.bmp');
fBitmap.PixelFormat :=pf8bit;
fBitmap.Free;
end;
//连接要做的事
procedure TForm1.CS_Connect(Sender: TObject; Socket: TCustomWinSocket);
begin
m.Position := 0;
socket.SendStream(m);
cs.OnDisconnect:=CS_DisConnect;
end;
//关闭
procedure TForm1.CS_DisConnect(Sender: TObject; Socket: TCustomWinSocket);
begin
(Sender as TClientSocket).socket.close;
end;
//点击按钮发送消息
procedure TForm1.Button1Click(Sender: TObject);
begin
cs:= TClientSocket.Create(nil);
cs.Host:='192.168.0.21';
cs.Port:= 1234;
SaveScrToStream();
m.Free;
m := tfilestream.Create('C:/aa.bmp',fmOpenRead );
cs.OnConnect:= CS_Connect;
cs.Open;
end;
第一次在服务器端已经完整传过去了,第二次的时候出现External exception C0000008的错误