unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure loadCursor;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
CURSOR_HOURGLASS = 1;
procedure TForm1.Button1Click(Sender: TObject);
var
iCurrentCursor: Integer;
begin
//Loads Cursors Information
LoadCursor;
iCurrentCursor := Screen.Cursor;
Screen.Cursor := CURSOR_HOURGLASS;
sleep(2000);//wait for 2 seconds to display new cursor.
Screen.Cursor := iCurrentCursor;//returns orignial cursor
end;
procedure TForm1.LoadCursor;
var
h : THandle;
begin
//you may have to change this if your windows directory is different
if FileExists('C:\WINNT\Cursors\banana.ani') then
begin
h := LoadImage(0,
'C:\WINNT\Cursors\banana.ani',
IMAGE_CURSOR,
0,
0,
LR_DEFAULTSIZE or
LR_LOADFROMFILE);
if h <> 0 then
Screen.Cursors[1] := h;
end;
end;
end.