var
hnew,hold:hcursor;
begin
hnew:=loadcursorfromfile('c:\dinosaur.ani');
hold:=setclasslong(form1.handle,gcl_hcursor,hnew);
end;
hnew,hold:hcursor;
begin
hnew:=loadcursorfromfile('c:\dinosaur.ani');
hold:=setclasslong(form1.handle,gcl_hcursor,hnew);
end;
sample_ani ANICURSOR sample.ani程序代码:procedure SaveResourceAsFile(const ResName: string; ResType: pchar;
const FileName: string);
begin
with TResourceStream.Create(hInstance, ResName, ResType) do
try
SaveToFile(FileName);
finally
Free;
end;
end;function SaveResourceAsTempFile(const ResName: string; ResType: pchar): string;
begin
Result := CreateTempFile;
SaveResourceAsFile(ResName, ResType, Result);
end;function GetResourceAsAniCursor(const ResName: string): HCursor;
var
CursorFile: string;
begin
CursorFile := SaveResourceAsTempFile(ResName, 'ANICURSOR');
Result := LoadImage(0, PChar(CursorFile), IMAGE_CURSOR, 0,
0, LR_DEFAULTSIZE or LR_LOADFROMFILE);
DeleteFile(CursorFile);
if Result = 0 then
raise Exception.Create(SysErrorMessage(GetLastError));
end;