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}
function LoadAniCursor(hInst : Cardinal; lpID : PChar; lpType : PChar =
nil) : HCURSOR;
var
hRes : HRSRC;
dwSize : DWORD;
hGlob : HGLOBAL;
pBytes : PBYTE;
begin
result := 0;
If not Assigned(lpType)
then
lpType := PChar('
ANICURSOR');
// Muss hier wirklich Anicursor stehen oder der Name vom Cursor?
If (Cardinal(lpID) < $10000)
then
hRes := FindResource(hInst, PChar('
#' + IntToStr(Cardinal(lpID))), lpType)
else
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));
If Assigned(pBytes)
then
result := HCURSOR(CreateIconFromResource(pBytes, dwSize, FALSE, $00030000));
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var ID : tcursor;
begin
ID := 10;
Screen.Cursors[ID] := LoadAniCursor(hInstance, '
1');
// in der Function sind 3 Parameter.. Warum
screen.cursor:= ID;
// hier nur 2?
end;
end.