| View previous topic :: View next topic |
| Author |
Message |
Old Wolf Guest
|
Posted: Wed May 31, 2006 4:37 am Post subject: How to use TAnimate::ResHandle |
|
|
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
|
Posted: Wed May 31, 2006 4:45 am Post subject: Re: How to use TAnimate::ResHandle |
|
|
"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
|
Posted: Fri Jun 02, 2006 4:16 am Post subject: Re: How to use TAnimate::ResHandle |
|
|
"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
|
Posted: Tue Jun 06, 2006 8:11 am Post subject: Re: How to use TAnimate::ResHandle |
|
|
"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
|
Posted: Mon Jun 19, 2006 6:54 am Post subject: Re: How to use TAnimate::ResHandle |
|
|
"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 |
|
 |
|