// Based on 31 March 2001 UseNet Post by Milen Boev to borland.public.delphi.graphics // efg, 31 March 2001 unit ScreenShowCursor; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm1 = class(TForm) Image: TImage; LabelLocation: TLabel; Timer: TTimer; procedure TimerTimer(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.TimerTimer(Sender: TObject); var Bitmap : TBitmap; CursorInfo: TCursorInfo; P : TPoint; begin GetCursorPos(P); LabelLocation.Caption := '(' + IntToStr(P.X) + ', ' + IntToStr(P.Y) + ')'; CursorInfo.cbSize := SizeOf(CursorInfo); GetCursorInfo(CursorInfo); // To overlay cursor on screen dump // DrawIconEx(Bmp.Canvas.Handle, P.X, P.Y, CusorInfo.hCursor, 32, 32, 0, 0, DI_NORMAL); // Display cursor at current position Bitmap := TBitmap.Create; TRY Bitmap.Width := 32; Bitmap.Height := 32; DrawIconEx(Bitmap.Canvas.Handle, 0,0, CursorInfo.hCursor, 32,32, 0,0, DI_NORMAL) ; Image.Picture.Graphic := Bitmap FINALLY Bitmap.Free END end; end.