1
2 unit Unit1;
3
4 interface
5
6 uses
7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8 Dialogs, StdCtrls;
9
10 type
11 TForm1 = class(TForm)
12 Button1: TButton;
13 procedure Button1Click(Sender: TObject);
14 private
15 { Private declarations }
16 public
17 { Public declarations }
18 procedure loadCursor;
19 end;
20
21 var
22 Form1: TForm1;
23
24 implementation
25
26 {$R *.dfm}
27 const
28 CURSOR_HOURGLASS = 1;
29
30 procedure TForm1.Button1Click(Sender: TObject);
31 var
32 iCurrentCursor: Integer;
33 begin
34 //Loads Cursors Information
35 LoadCursor;
36 iCurrentCursor := Screen.Cursor;
37
38 Screen.Cursor := CURSOR_HOURGLASS;
39 sleep(2000);//wait for 2 seconds to display new cursor.
40 Screen.Cursor := iCurrentCursor;//returns orignial cursor
41
42 end;
43
44
45 procedure TForm1.LoadCursor;
46 var
47 h : THandle;
48 begin
49 //you may have to change this if your windows directory is different
50 if FileExists('C:\WINNT\Cursors\banana.ani') then
51 begin
52 h := LoadImage(0,
53 'C:\WINNT\Cursors\banana.ani',
54 IMAGE_CURSOR,
55 0,
56 0,
57 LR_DEFAULTSIZE or
58 LR_LOADFROMFILE);
59
60 if h <> 0 then
61 Screen.Cursors[1] := h;
62 end;
63 end;
64
65
66 end.
|