Animation cursor is a file with ANI as the extension. Its function is to make your mouse shape an animation, not just an oblique triangle. The specific method is as follows:
Create a new project, put a BUTTON1 on FORM1, and then find an animation cursor file *.ANI. You can download one online, or find one from some CDs (such as: Find *.ANI file), and then enter the following code :
unit CURSOR;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
Type TForm1 = class(Tform)
Button1: Tbutton;
PRocedure FormCreate(Sender: Tobject);
procedure FormClose(Sender: Tobject; var Action: TCloseAction);
procedure Button1Click(Sender: Tobject);
private { Private declarations }
public { Public declarations }
end;
var
Form1: TForm1;
HOLDCURSOR:HCURSOR; ′ defines a variable
Implementation {$R *.DFM}
procedure TForm1.FormCreate(Sender: Tobject);
VAR
HNEWCURSOR:HCURSOR;
Begin
BUTTON1.CAPTION:=′Close′;
HNEWCURSOR:=LOADCURSORFROMFILE(′E:/BATMAN.ANI′);
{Call the API function to load the animation cursor file, please adjust the ANI file path according to your actual situation}
HOLDCURSOR:=SETCLASSLONG(FORM1.HANDLE,GCL_HCURSOR,HNEWCURSOR);
{Save the original cursor for future recovery}
end;
procedure TForm1.Button1Click(Sender: Tobject);
Begin
HOLDCURSOR:=SETCLASSLONG(FORM1.HANDLE,GCL_HCURSOR,HOLDCURSOR);
CLOSE(); {Don't forget to restore the cursor before ending the program}
end;
end.
Now you run it (press F9), and after starting it, the cursor becomes the animation cursor.