Re: Custom cursor in Delphi

Posted by Bram on September 19, 2007

In Reply to Cursors posted by Bradley on August 15, 2007

: I do delphi at school and i want to make my programs original. I made myself a custom cursor in the format ".cur". I want to know if i can somehow add this to Delphi. Please help me!!

Delphi has no direct routine for loading a custom cursor from a cursor-file, but it is possible with the Win API function LoadCursorFromFile. Source code example, with cursor file 'NewCursor.cur' in the directory of your application:

const 
  crNewCursor = 1;
  CurFile = 'NewCursor.cur';
var
  CurFilePath: string;
...
begin
  CurFilePath := ExtractFileDir(Application.ExeName) + '\' + CurFile;
  Screen.Cursors[crNewCursor2] :=
    LoadCursorFromFile(PChar(CurFilePath));
  Screen.Cursor := crNewCursor2;
end;

Good luck!
Bram