1 2 //--------------------------------------------------------------------------- 3 4 #include <vcl.h> 5 #pragma hdrstop 6 7 #include "Unit1.h" 8 //--------------------------------------------------------------------------- 9 #pragma package(smart_init) 10 #pragma resource "*.dfm" 11 TForm1 *Form1; 12 //--------------------------------------------------------------------------- 13 __fastcall TForm1::TForm1(TComponent* Owner) 14 : TForm(Owner) 15 { 16 } 17 //--------------------------------------------------------------------------- 18 const 19 CURSOR_HOURGLASS = 1; 20 21 22 void __fastcall TForm1::Button1Click(TObject *Sender) 23 { 24 int iCurrentCursor; 25 //you may have to change this if your windows directory is different 26 HCURSOR hCursor = LoadCursorFromFile("C:\\WINNT\\Cursors\\banana.ani"); 27 if( hCursor ) Screen->Cursors[CURSOR_HOURGLASS] = hCursor; 28 iCurrentCursor = Screen->Cursor; 29 Screen->Cursor = CURSOR_HOURGLASS; 30 Sleep(2000);//wait for 2 seconds to display new cursor. 31 Screen->Cursor = iCurrentCursor;//returns orignial cursor 32 33 } 34 //---------------------------------------------------------------------------