I am using Delphi 7 under Windows 7 to download files.
I want to change the cursor during the download.
I set the Screen.Cursor := crHourG
does other numbers produce meaning full cursors
No. Other numbers besides built-in cursors constants will produce a default cursor which is identical to TCursor(crDefault)
(in other terms - HCURSOR(Screen.Cursors[crDefault])
). These built-in cursors resides in the application resources and preloaded on VCL startup. To add custom cursor you HAVE to add CURSOR resource and then load it and add it to VCL.
procedure TForm1.FormCreate(Sender: TObject); platform;
const
crCustom = 42;
var
Cursor: HCURSOR;
begin
Cursor := LoadCursor(HInstance, 'CUSTOM');
Win32Check(Cursor <> 0); // required error check
Screen.Cursors[crCustom] := Cursor;
{ Done, newly added crCustom is ready to use }
Self.Cursor := crCustom; // for example - lets show custom cursor
{ also, TScreen object will manage resource handle }
{ and perform cleanup for you, so DestroyCursor call is unnecessary }
end;
More complicated example with indirect cursor construction NB: example have numerous flaws: 1) DestroyIcon
call is erroneous 2) they'd noticed it if there was error checking after all API calls