Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
205 views
in Technique[技术] by (71.8m points)

delphi - Animated Cursor Playing

I have a Form "TForm1" having one "TAnimate1". I have one AVI Resource as File Name "Animate 01.avi" with Resource Identifier "AVI" and one "Animated Cursor" as File Name "Cursor 01.ani" with Resource Identifier "8".I wish to play "Animate 01.avi" on "FormCreate" event and set default cursor as "8". I'm using "Delphi XE2".

Please download my project file from "http://hotfile.com/dl/137675080/34f701f/KoushikHalder01.7z.html" and tell where to rectify.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Ok, downloaded...

First, you're putting the avi in an 'RCDATA' section. As I've already said, that won't work. An animate control loads the avi file of an AVI type. So this line

AVI RCDATA "KoushikHalder.avi"

in your '.rc' file, should be in fact:

AVI AVI "KoushikHalder.avi"

You can put whatever you like for ID, but the resource type should be AVI.


Second, you would load the avi by its resource identifier. You've given an 'AVI' identifier for it. So this line in your code:

Animate01.ResName :='KoushikHalder.avi';

should in fact be:

Animate01.ResName :='AVI';


Third, your '.ani' file does not conform with the standards. See this question for details. You won't be able to load that ani file unless you correct it.


Fourth, you're not loading the ani file correctly. It's identifier is not '8', it's 8. So the below line:

Screen.Cursors[8] := LoadCursor(HInstance, '8');

Should be

Screen.Cursors[8] := LoadCursor(HInstance, MakeIntResource(8));

(or Pointer(8)..).


Lastly, you have to set the cursor somewhere to your ani file so that you can see it. For instance:

Screen.Cursor := 8;

or

BitBtn01.Cursor := 8;



I hope this helps...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...