procedure TForm1.SendScreen(Sender: TObject; Socket: TCustomWinSocket);
var
outwin:hdc;
obitmap,bitmap:HBitmap;
pox,poy:integer;
pos:tpoint;
temp:string;
begin
outwin:=windows.CreateCompatibleDC(screen);
bitmap:=windows.CreateCompatibleBitmap(screen,1024,768);
obitmap:=selectobject(outwin,bitmap);
bitblt(outwin,0,0,1024,768,screen,0,0,srccopy);
GetBitmapBits(bitmap,1024*768*4,@outbuff); //所花时间最多
selectobject(outwin,obitmap);
deleteobject(bitmap);
deleteobject(outwin);for poy:=1 to 384 do
begin
for pox:=1 to 512 do
begin
outbuff[pox+(poy-1)*512]:=outbuff[pox*2+(poy-1)*2*1024];
end;
end;
GetCursorPos(pos);
outbuff[512*384+1]:=pos.X;
outbuff[512*384+2]:=pos.Y;
temp:=inttohex(outbuff[512*384+1],8)+'-'+inttohex(outbuff[512*384+2],8);
socket.SendBuf(outbuff,512*384*4+8);
listbox1.Items.Add('cap screen suc-'+temp);
end;
var
outwin:hdc;
obitmap,bitmap:HBitmap;
pox,poy:integer;
pos:tpoint;
temp:string;
begin
outwin:=windows.CreateCompatibleDC(screen);
bitmap:=windows.CreateCompatibleBitmap(screen,1024,768);
obitmap:=selectobject(outwin,bitmap);
bitblt(outwin,0,0,1024,768,screen,0,0,srccopy);
GetBitmapBits(bitmap,1024*768*4,@outbuff); //所花时间最多
selectobject(outwin,obitmap);
deleteobject(bitmap);
deleteobject(outwin);for poy:=1 to 384 do
begin
for pox:=1 to 512 do
begin
outbuff[pox+(poy-1)*512]:=outbuff[pox*2+(poy-1)*2*1024];
end;
end;
GetCursorPos(pos);
outbuff[512*384+1]:=pos.X;
outbuff[512*384+2]:=pos.Y;
temp:=inttohex(outbuff[512*384+1],8)+'-'+inttohex(outbuff[512*384+2],8);
socket.SendBuf(outbuff,512*384*4+8);
listbox1.Items.Add('cap screen suc-'+temp);
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货