鼠标的获取和信息的识别

 
    
procedure TForm1.btnClick(Sender: TObject);
var
bmp:TBitmap;
hCur : TCursorInfo;
begin
// ffffff - e2e2e2
cur :
= TIcon.Create;
bmp:
= TBitmap.Create;
ZeroMemory(@hCur,sizeof(hCur));
hCur.cbSize:
= SizeOf(hCur);
GetCursorInfo(hCur);
self.cur.Handle:
= hCur.hCursor ;
bmp.Width :
= cur.Width;
bmp.Height :
= cur.Height;
bmp.PixelFormat :
= pf24bit;
bmp.Canvas.Brush.Color :
= clFuchsia;
bmp.Canvas.Pen.Color :
= clFuchsia;
bmp.Canvas.Rectangle(
0 , 0 ,bmp.Width,bmp.Height );
if DrawIconEx(bmp.Canvas.Handle, 0 , 0 ,self.cur.Handle, 0 , 0 , 0 , 0 ,DI_NORMAL) then
bmp.SaveToFile(
' 1.bmp ' );
Sleep(
10 );
mmo.Lines.Add (dm.OcrInFile(
0 , 0 ,bmp.Width,bmp.Height,GetCurrentDir + ' \1.bmp ' , ' ffffff-e2e2e2 ' , 1.0 ));
DeleteFile(GetCurrentDir
+ ' \1.bmp ' );
bmp.Free;
cur.Free;
end ;

 

转载于:https://www.cnblogs.com/rogee/archive/2010/09/16/1828122.html

你可能感兴趣的:(鼠标的获取和信息的识别)