BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to use TAnimate::ResHandle

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Old Wolf
Guest





PostPosted: Wed May 31, 2006 4:37 am    Post subject: How to use TAnimate::ResHandle Reply with quote



I see in the documentation that TAnimate can take a handle to
a resource in a resource file, instead of specifying a filename.

I would like to do this in my COM DLL project, so that my
animation keeps working even if the host DLL is moved separately
to the AVI file.

How can I add the AVI as a resource to my project?

I see the 'Resource DLL wizard' but that would seem to leave me
with the same problem (namely that the resource DLL could be
deleted or mvoed).
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed May 31, 2006 4:45 am    Post subject: Re: How to use TAnimate::ResHandle Reply with quote



"Old Wolf" <oldwolf (AT) inspire (DOT) net.nz> wrote in message
news:447cd749$1 (AT) newsgroups (DOT) borland.com...

Quote:
How can I add the AVI as a resource to my project?

Add an .RC file to the project, specifying the .avi file to include in the
compiled executable. Then use the HINSTANCE that is provided as a parameter
to your DllEntryPoint() function as the ResHandle value. The .RC file would
also define the ID that you have to provide to the ResID property.


Gambit
Back to top
Old Wolf
Guest





PostPosted: Fri Jun 02, 2006 4:16 am    Post subject: Re: How to use TAnimate::ResHandle Reply with quote



"Remy Lebeau \(TeamB\)" <no.spam (AT) no (DOT) spam.com> wrote:
Quote:
"Old Wolf" <oldwolf (AT) inspire (DOT) net.nz> wrote:

How can I add the AVI as a resource to my project?

Add an .RC file to the project, specifying the .avi file to
include in the compiled executable. Then use the HINSTANCE
that is provided as a parameter to your DllEntryPoint()
function as the ResHandle value. The .RC file would also
define the ID that you have to provide to the ResID property.

Has anyone done this before? It doesn't seem to work quite as
the manual described.

The manual says "you can set ResHandle then ResId", but if
you set one or the other then it tries to open the resource
immediately and fails.

It also says you can set ResId at design-time, but ResId
is not published, so you can't.

I added a .rc file to the project:

123 VIDEO MyAnimation.avi

and it compiled correctly. My code is (including the
try...catch so it can catch the 'Cannot open AVI'
exception generated by setting ResName):

if ( animProgress->ResHandle == 0 )
{
try { animProgress->ResHandle =
(UINT)_Module.GetResourceInstance(); } catch(...) {}
animProgress->ResId = 123;
}
animProgress->Active = true;

But then the setting ResID fails with the same exception
and I don't know how to proceed from here.
Switching the order of ResId and ResHandle makes no difference.
Using GetModuleInstance instead of GetResourceInstance makes
no difference. (This is the same handle as was passed to
DllEntryPoint).

By tracing through VCL source I got to the line in TAnimate:

Perform(ACM_OPEN, GetActualResHandle, GetActualResId)

which processes a Windows Message with wParam = ResHandle
and lParam = ResId. But the Win32 documentation says that
this is not the right format (you have to create the
Animate window with the ResHandle, and you only pass the
ResId to ACM_OPEN). So I am not sure how it is supposed
to work at all.
Back to top
Todd Brylski
Guest





PostPosted: Tue Jun 06, 2006 8:11 am    Post subject: Re: How to use TAnimate::ResHandle Reply with quote

"Old Wolf" <oldwolf (AT) inspire (DOT) net.nz> wrote in message news:447f8af1$1 (AT) newsgroups (DOT) borland.com...
Quote:
The manual says "you can set ResHandle then ResId", but if
you set one or the other then it tries to open the resource
immediately and fails.

TAnimate was not programmed correctly.
This is one solution:

try
{
Animate1->ResHandle = (unsigned) YourModuleHandle;
}
catch( Exception& e )
{
Animate1->ResId = 123;
}

Quote:
I added a .rc file to the project:
123 VIDEO MyAnimation.avi

Change that to:
123 AVI MyAnimation.avi

Todd

BCB5/W2K
Back to top
Old Wolf
Guest





PostPosted: Mon Jun 19, 2006 6:54 am    Post subject: Re: How to use TAnimate::ResHandle Reply with quote

"Todd Brylski" <tbrylski (AT) yahoo (DOT) com> wrote:
Quote:

TAnimate was not programmed correctly.
This is one solution:

try
{
Animate1->ResHandle = (unsigned) YourModuleHandle;
}
catch( Exception& e )
{
Animate1->ResId = 123;
}

I added a .rc file to the project:
123 VIDEO MyAnimation.avi

Change that to:
123 AVI MyAnimation.avi


Thanks -- that worked.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.