Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...