本文整理自网络,侵删。
{$R *.dfm}
var h: HWND;
pt,p1: TPoint;
arr,arr1: array[0..254] of Char;
h1: HCURSOR;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Timer1.Enabled:=True;
Image1.Picture.LoadFromFile('02.bmp');
// h1:=LoadCursorFromFile('031.ico'); //031.ico
// SetSystemCursor(h1,ocr_normal);
Screen.Cursor:=crCross;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var p1:TPoint;
begin
GetCursorPos(p1);
h :=WindowFromPoint(p1);
label1.Caption:=Format('%d,%d',[p1.X,p1.Y]);
end;
procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Screen.Cursor:=crDefault;
Timer1.Enabled:=False;
Label1.Caption:='';
Image1.Picture.LoadFromFile('01.bmp');
// SystemParametersinfo(SPI_SETCURSORS,0,nil,SPIF_SENDCHANGE);
Screen.Cursor:=crDefault;
GetClassName(h, arr, Length(arr));
GetWindowText(h, @arr1, SizeOf(arr));
Edit2.Text := arr;
Edit1.Text:=arr1;
end;
相关阅读 >>
incsecond:将一个tdatetime变量加减一定数量的秒数
更多相关阅读请进入《Delphi》频道 >>