问题:把劲舞团运行放在一边,用delphi编写程序出来给桌面截图,保存在image1.Picture.Bitmap中,
图片能够正常显示,但是使用image1.Picture.Bitmap.Canvas.Pixels[x,y]获取某坐标颜色值时,
其中大部分坐标会返回0或者-1,跟该点颜色完全无关!此时如果关闭劲舞团,则一切恢复正常,能正常返回颜色值。
相关代码:
function CaptureScreen(x,y,wid,hei:integer):TBitMap;
const
CAPTUREBLT = $40000000;
var
hdcScreen: HDC;
hdcCompatible: HDC;
bmp: TBitmap;
hbmScreen: HBITMAP;
begin
hdcScreen := CreateDC('DISPLAY', nil, nil, nil);
hdcCompatible := CreateCompatibleDC(hdcScreen);
hbmScreen := CreateCompatibleBitmap(hdcScreen,
GetDeviceCaps(hdcScreen, HORZRES),
GetDeviceCaps(hdcScreen, VERTRES));
SelectObject(hdcCompatible, hbmScreen);
bmp := TBitmap.Create;
bmp.Handle := hbmScreen;
BitBlt(hdcCompatible,0, 0,wid, hei,hdcScreen,x, y,SRCCOPY or CAPTUREBLT);
result:=bmp;
DeleteDC(hdcScreen);
DeleteDC(hdcCompatible);
end;procedure TForm1.Button1Click(Sender: TObject);
var
buf:TBitMap;
begin
buf:=captureScreen(0,0,screen.Width,screen.Height);
image1.Picture.Bitmap:=buf;
buf.Free;
end;procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
begin
label1.Caption:=inttostr(x)+':'+inttostr(y)+'@'+inttostr(image1.Picture.Bitmap.Canvas.Pixels[x,y]);
end;用这个代码,在劲舞团运行的状态下,给定坐标的颜色值无法正常得到,但是关闭劲舞团后没有此问题。
哪位高手能帮我看看劲舞团到底搞了什么鬼?
图片能够正常显示,但是使用image1.Picture.Bitmap.Canvas.Pixels[x,y]获取某坐标颜色值时,
其中大部分坐标会返回0或者-1,跟该点颜色完全无关!此时如果关闭劲舞团,则一切恢复正常,能正常返回颜色值。
相关代码:
function CaptureScreen(x,y,wid,hei:integer):TBitMap;
const
CAPTUREBLT = $40000000;
var
hdcScreen: HDC;
hdcCompatible: HDC;
bmp: TBitmap;
hbmScreen: HBITMAP;
begin
hdcScreen := CreateDC('DISPLAY', nil, nil, nil);
hdcCompatible := CreateCompatibleDC(hdcScreen);
hbmScreen := CreateCompatibleBitmap(hdcScreen,
GetDeviceCaps(hdcScreen, HORZRES),
GetDeviceCaps(hdcScreen, VERTRES));
SelectObject(hdcCompatible, hbmScreen);
bmp := TBitmap.Create;
bmp.Handle := hbmScreen;
BitBlt(hdcCompatible,0, 0,wid, hei,hdcScreen,x, y,SRCCOPY or CAPTUREBLT);
result:=bmp;
DeleteDC(hdcScreen);
DeleteDC(hdcCompatible);
end;procedure TForm1.Button1Click(Sender: TObject);
var
buf:TBitMap;
begin
buf:=captureScreen(0,0,screen.Width,screen.Height);
image1.Picture.Bitmap:=buf;
buf.Free;
end;procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
begin
label1.Caption:=inttostr(x)+':'+inttostr(y)+'@'+inttostr(image1.Picture.Bitmap.Canvas.Pixels[x,y]);
end;用这个代码,在劲舞团运行的状态下,给定坐标的颜色值无法正常得到,但是关闭劲舞团后没有此问题。
哪位高手能帮我看看劲舞团到底搞了什么鬼?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货