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 }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$R cursorausgelastet.res} //<--- eigener Cursor 1 anicursor "cursorausgelastet.ani"
function LoadAniCursor(hInst : Cardinal; lpID : PChar; lpType : PChar =
nil) : HCURSOR;
var
hRes : HRSRC;
dwSize : DWORD;
hGlob : HGLOBAL;
pBytes : PBYTE;
begin
If not Assigned(lpType)
then
lpType := PChar('
ANICURSOR');
If (StrToIntDef(StrPas(lpID), 0) <> 0)
then
hRes := FindResource(hInst, PChar('
#' + StrPas(lpID)), lpType)
else
hRes := FindResource(hInst, lpID, lpType);
dwSize := SizeofResource(hInst, hRes);
hGlob := LoadResource(hInst, hRes);
If (hGlob <> 0)
then
begin
pBytes := PBYTE(LockResource(hGlob));
result := HCURSOR(CreateIconFromResource(pBytes, dwSize, FALSE, $00030000));
end
else
result := 0;
end;
procedure TForm1.Button1Click(Sender: TObject);
var ID : tcursor;
begin
ID := 10;
Screen.Cursors[ID] := LoadAniCursor(hInstance, MAKEINTRESOURCE(1));
// <-- In die Zeile springt er
screen.cursor:= ID;
end;
end.