From: Sonu on
Hello all...
I have an animate ctrl in a dialog box, which plays the simple
document_search.avi fileof the magnifying glass moving around while I am
doing a task in the background.
This code used to work when I had my project in VC6.0 and maybe also in
VS2003 but when I moved it in VS2005 (or was it already in 2003) the
animation doesn't work.
So the users think that the program is crashing now as it's kinda frozen and
no animation to console them!
At the beg of the task:
m_search_animate.ShowWindow(SW_SHOW);
extern CString mod_dir;
m_search_animate.Open( mod_dir + _T("\\document search.avi") );
m_search_animate.Play( 0, -1, -1 );

at the end of the task:

m_search_animate.Stop();
m_search_animate.Close();
m_search_animate.EnableWindow(FALSE);
m_search_animate.ShowWindow(SW_HIDE);

Also, the parameters of the Play() are UINTs. So when I give -1 for the
parameters for continuous play as described int he MSDN, I get
warnings...While I am not very fond of!
Please help
Thanks
Srishti

From: AliR (VC++ MVP) on
What's in mod_dir make sure that you are not adding too many \ to the path.
If mod_dir ends with \\ and you add \\ then you will endup with an invalid
path.


AliR.

"Sonu" <sonu(a)online.nospam> wrote in message
news:D70DB990-0486-4346-807E-171BFC24EF93(a)microsoft.com...
> Hello all...
> I have an animate ctrl in a dialog box, which plays the simple
> document_search.avi fileof the magnifying glass moving around while I am
> doing a task in the background.
> This code used to work when I had my project in VC6.0 and maybe also in
> VS2003 but when I moved it in VS2005 (or was it already in 2003) the
> animation doesn't work.
> So the users think that the program is crashing now as it's kinda frozen
> and
> no animation to console them!
> At the beg of the task:
> m_search_animate.ShowWindow(SW_SHOW);
> extern CString mod_dir;
> m_search_animate.Open( mod_dir + _T("\\document search.avi") );
> m_search_animate.Play( 0, -1, -1 );
>
> at the end of the task:
>
> m_search_animate.Stop();
> m_search_animate.Close();
> m_search_animate.EnableWindow(FALSE);
> m_search_animate.ShowWindow(SW_HIDE);
>
> Also, the parameters of the Play() are UINTs. So when I give -1 for the
> parameters for continuous play as described int he MSDN, I get
> warnings...While I am not very fond of!
> Please help
> Thanks
> Srishti
>


From: Sonu on
Here is the code for mod_dir and no, I don't think that is the problem!

extern CString mod_dir;
TCHAR file[_MAX_PATH];
GetModuleFileName( NULL, file, _MAX_PATH );
mod_dir = file;
mod_dir = mod_dir.Mid( 0, mod_dir.ReverseFind( '\\' ) );
#if _DEBUG
mod_dir = mod_dir.Mid( 0, mod_dir.ReverseFind( '\\' ) );
mod_dir += _T("\\Release");
#endif


"AliR (VC++ MVP)" wrote:

> What's in mod_dir make sure that you are not adding too many \ to the path.
> If mod_dir ends with \\ and you add \\ then you will endup with an invalid
> path.
>
>
> AliR.
>
> "Sonu" <sonu(a)online.nospam> wrote in message
> news:D70DB990-0486-4346-807E-171BFC24EF93(a)microsoft.com...
> > Hello all...
> > I have an animate ctrl in a dialog box, which plays the simple
> > document_search.avi fileof the magnifying glass moving around while I am
> > doing a task in the background.
> > This code used to work when I had my project in VC6.0 and maybe also in
> > VS2003 but when I moved it in VS2005 (or was it already in 2003) the
> > animation doesn't work.
> > So the users think that the program is crashing now as it's kinda frozen
> > and
> > no animation to console them!
> > At the beg of the task:
> > m_search_animate.ShowWindow(SW_SHOW);
> > extern CString mod_dir;
> > m_search_animate.Open( mod_dir + _T("\\document search.avi") );
> > m_search_animate.Play( 0, -1, -1 );
> >
> > at the end of the task:
> >
> > m_search_animate.Stop();
> > m_search_animate.Close();
> > m_search_animate.EnableWindow(FALSE);
> > m_search_animate.ShowWindow(SW_HIDE);
> >
> > Also, the parameters of the Play() are UINTs. So when I give -1 for the
> > parameters for continuous play as described int he MSDN, I get
> > warnings...While I am not very fond of!
> > Please help
> > Thanks
> > Srishti
> >
>
>
>
From: AliR (VC++ MVP) on
Have you stepped through the code to see what is getting passed to
m_search_animate.Open?

As far as the code below: I don't understand what you are trying to do with
the += _T("\\Release");

AliR.


"Sonu" <sonu(a)online.nospam> wrote in message
news:96D8515C-A9A3-4A0E-8700-2C76659098CA(a)microsoft.com...
> Here is the code for mod_dir and no, I don't think that is the problem!
>
> extern CString mod_dir;
> TCHAR file[_MAX_PATH];
> GetModuleFileName( NULL, file, _MAX_PATH );
> mod_dir = file;
> mod_dir = mod_dir.Mid( 0, mod_dir.ReverseFind( '\\' ) );
> #if _DEBUG
> mod_dir = mod_dir.Mid( 0, mod_dir.ReverseFind( '\\' ) );
> mod_dir += _T("\\Release");
> #endif
>
>
> "AliR (VC++ MVP)" wrote:
>
>> What's in mod_dir make sure that you are not adding too many \ to the
>> path.
>> If mod_dir ends with \\ and you add \\ then you will endup with an
>> invalid
>> path.
>>
>>
>> AliR.
>>
>> "Sonu" <sonu(a)online.nospam> wrote in message
>> news:D70DB990-0486-4346-807E-171BFC24EF93(a)microsoft.com...
>> > Hello all...
>> > I have an animate ctrl in a dialog box, which plays the simple
>> > document_search.avi fileof the magnifying glass moving around while I
>> > am
>> > doing a task in the background.
>> > This code used to work when I had my project in VC6.0 and maybe also in
>> > VS2003 but when I moved it in VS2005 (or was it already in 2003) the
>> > animation doesn't work.
>> > So the users think that the program is crashing now as it's kinda
>> > frozen
>> > and
>> > no animation to console them!
>> > At the beg of the task:
>> > m_search_animate.ShowWindow(SW_SHOW);
>> > extern CString mod_dir;
>> > m_search_animate.Open( mod_dir + _T("\\document search.avi") );
>> > m_search_animate.Play( 0, -1, -1 );
>> >
>> > at the end of the task:
>> >
>> > m_search_animate.Stop();
>> > m_search_animate.Close();
>> > m_search_animate.EnableWindow(FALSE);
>> > m_search_animate.ShowWindow(SW_HIDE);
>> >
>> > Also, the parameters of the Play() are UINTs. So when I give -1 for the
>> > parameters for continuous play as described int he MSDN, I get
>> > warnings...While I am not very fond of!
>> > Please help
>> > Thanks
>> > Srishti
>> >
>>
>>
>>


From: Joseph M. Newcomer on
See below...
On Mon, 3 Mar 2008 13:13:02 -0800, Sonu <sonu(a)online.nospam> wrote:

>Here is the code for mod_dir and no, I don't think that is the problem!
>
> extern CString mod_dir;
> TCHAR file[_MAX_PATH];
> GetModuleFileName( NULL, file, _MAX_PATH );
> mod_dir = file;
> mod_dir = mod_dir.Mid( 0, mod_dir.ReverseFind( '\\' ) );
****
Seems a bit odd; why not
int n = mod_dir.ReverseFind(_T('\\'));
if(n < 0)
... deal with lack of any path
else
mod_dir = mod_dir.Left(n + 1);
Note that if you are using _T() as below, you must ALSO use _T() around the character
constants! But presuming that the value will be non-negative is dangerous. Also, you
should assume that _T('/') is a valid path delimiter. Better still, use _tsplitpath and
_tmakepath (or in VS2005, _tsplitpath_s and _tmakepath_s).
joe
****
>#if _DEBUG
> mod_dir = mod_dir.Mid( 0, mod_dir.ReverseFind( '\\' ) );
> mod_dir += _T("\\Release");
>#endif
>
>
>"AliR (VC++ MVP)" wrote:
>
>> What's in mod_dir make sure that you are not adding too many \ to the path.
>> If mod_dir ends with \\ and you add \\ then you will endup with an invalid
>> path.
>>
>>
>> AliR.
>>
>> "Sonu" <sonu(a)online.nospam> wrote in message
>> news:D70DB990-0486-4346-807E-171BFC24EF93(a)microsoft.com...
>> > Hello all...
>> > I have an animate ctrl in a dialog box, which plays the simple
>> > document_search.avi fileof the magnifying glass moving around while I am
>> > doing a task in the background.
>> > This code used to work when I had my project in VC6.0 and maybe also in
>> > VS2003 but when I moved it in VS2005 (or was it already in 2003) the
>> > animation doesn't work.
>> > So the users think that the program is crashing now as it's kinda frozen
>> > and
>> > no animation to console them!
>> > At the beg of the task:
>> > m_search_animate.ShowWindow(SW_SHOW);
>> > extern CString mod_dir;
>> > m_search_animate.Open( mod_dir + _T("\\document search.avi") );
>> > m_search_animate.Play( 0, -1, -1 );
>> >
>> > at the end of the task:
>> >
>> > m_search_animate.Stop();
>> > m_search_animate.Close();
>> > m_search_animate.EnableWindow(FALSE);
>> > m_search_animate.ShowWindow(SW_HIDE);
>> >
>> > Also, the parameters of the Play() are UINTs. So when I give -1 for the
>> > parameters for continuous play as described int he MSDN, I get
>> > warnings...While I am not very fond of!
>> > Please help
>> > Thanks
>> > Srishti
>> >
>>
>>
>>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm