|
QUESTION: How do I get the handle of the current cursor and draw on my form? ANSWER:
There is a Windows API call to do this: DrawIconEx(). This function draws an icon or cursor in the area specified by the X and Y coordinates, that are parameters to this function. You can pass it a given handle and it will draw that icon. Here is an example that sets the cursor handle and draws the icon.
procedure TForm1.Button1Click(Sender: TObject);
var
HCursor : THandle;
begin
HCursor:= Screen.Cursors[Ord(Screen.Cursor)];//Gets the cursor handle.
// X Y Size
DrawIconEx(Form1.Canvas.Handle, 150, 150, HCursor, 32, 32,
0, 0, DI_NORMAL);//Draws to canvas
end;
|
Last Modified: 03-AUG-01