From: Sonu on 4 Mar 2008 20:12 That makes things complicated! Why didn't they leave it as it used to be!!! According to the link by Jeff Partch in this thread... Play() used to create a separate thread... and now it doesn't :( Thanks a lot Joseph... Maybe I'll just display a messege saying "Please wait" Regards Srishti "Joseph M. Newcomer" wrote: > That makes sense. I'd PostMessage to the main GUI thread and let it add elements. > joe > > On Tue, 4 Mar 2008 12:09:01 -0800, Sonu <sonu(a)online.nospam> wrote: > > >Well, of ourse I have removed the CDialog::OnOK() from the code... Sorry for > >the confusion. I should have said instead that it is in the OnClick of a > >button. > > > >Thanks > >Srishti > > > >"Joseph M. Newcomer" wrote: > > > >> But how can OnOK fill a listbox on the same dialog, when OnOK is going to kill off the > >> dialog making the listbox unavailable. > >> joe > >> > >> On Tue, 4 Mar 2008 10:44:00 -0800, Sonu <sonu(a)online.nospam> wrote: > >> > >> >Hmm.. Thanks Joseph... This is happeningin the OnOK() of a Dialog box. nd > >> >after the process is done it fill a list box on the same dialog with the > >> >results. It used to work in the older versions... :( > >> >I will try putting it in a separate thread! > >> >Thanks again > >> >Srishti > >> > > >> >"Joseph M. Newcomer" wrote: > >> > > >> >> OK, you have to make sure simple things like loading the file. But if you are doing the > >> >> WORK in the main GUI thread, the message pump is dead, your animation won't run, and your > >> >> screen will not refresh properly. You would need to do the search in a secondary thread, > >> >> and PostMessage to the main GUI thread to update the control. Otherwise, you will see > >> >> what you are reporting now. > >> >> joe > >> >> > >> >> On Mon, 3 Mar 2008 15:01:00 -0800, Sonu <sonu(a)online.nospam> wrote: > >> >> > >> >> >Ok, I added the _T() abound the Characters in .ReverseFind( '\\' ) ); > >> >> > > >> >> >But that is not the problem... The problem I am having is that the Amimation > >> >> >does not run... > >> >> >I see a stationary hourglass. But it does not move.... If the user refreshes > >> >> >the window, the stationary hourglass disappears and the ctrl that is about to > >> >> >get populated with the search results from the background process kindof > >> >> >becomes blank.. which leads the user to fear that the program has crashed, > >> >> >which is not the case... it's just that the animation is not working. > >> >> >Please note that this same code used to work when compiled in the older > >> >> >versions of VS. > >> >> > > >> >> >Thanks > >> >> >Srishti > >> >> > > >> >> > > >> >> > > >> >> >"Joseph M. Newcomer" wrote: > >> >> > > >> >> >> 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 > >> >> >> > >> >> Joseph M. Newcomer [MVP] > >> >> email: newcomer(a)flounder.com > >> >> Web: http://www.flounder.com > >> >> MVP Tips: http://www.flounder.com/mvp_tips.htm > >> >> > >> Joseph M. Newcomer [MVP] > >> email: newcomer(a)flounder.com > >> Web: http://www.flounder.com > >> MVP Tips: http://www.flounder.com/mvp_tips.htm > >> > Joseph M. Newcomer [MVP] > email: newcomer(a)flounder.com > Web: http://www.flounder.com > MVP Tips: http://www.flounder.com/mvp_tips.htm >
From: Joseph M. Newcomer on 4 Mar 2008 22:07 Someobody probably decided this was an "improvement"...and we *know* what happens when someone invents an "improvement"... joe On Tue, 4 Mar 2008 17:12:07 -0800, Sonu <sonu(a)online.nospam> wrote: >That makes things complicated! Why didn't they leave it as it used to be!!! >According to the link by Jeff Partch in this thread... Play() used to create >a separate thread... and now it doesn't :( > > >Thanks a lot Joseph... Maybe I'll just display a messege saying "Please wait" >Regards >Srishti > > > >"Joseph M. Newcomer" wrote: > >> That makes sense. I'd PostMessage to the main GUI thread and let it add elements. >> joe >> >> On Tue, 4 Mar 2008 12:09:01 -0800, Sonu <sonu(a)online.nospam> wrote: >> >> >Well, of ourse I have removed the CDialog::OnOK() from the code... Sorry for >> >the confusion. I should have said instead that it is in the OnClick of a >> >button. >> > >> >Thanks >> >Srishti >> > >> >"Joseph M. Newcomer" wrote: >> > >> >> But how can OnOK fill a listbox on the same dialog, when OnOK is going to kill off the >> >> dialog making the listbox unavailable. >> >> joe >> >> >> >> On Tue, 4 Mar 2008 10:44:00 -0800, Sonu <sonu(a)online.nospam> wrote: >> >> >> >> >Hmm.. Thanks Joseph... This is happeningin the OnOK() of a Dialog box. nd >> >> >after the process is done it fill a list box on the same dialog with the >> >> >results. It used to work in the older versions... :( >> >> >I will try putting it in a separate thread! >> >> >Thanks again >> >> >Srishti >> >> > >> >> >"Joseph M. Newcomer" wrote: >> >> > >> >> >> OK, you have to make sure simple things like loading the file. But if you are doing the >> >> >> WORK in the main GUI thread, the message pump is dead, your animation won't run, and your >> >> >> screen will not refresh properly. You would need to do the search in a secondary thread, >> >> >> and PostMessage to the main GUI thread to update the control. Otherwise, you will see >> >> >> what you are reporting now. >> >> >> joe >> >> >> >> >> >> On Mon, 3 Mar 2008 15:01:00 -0800, Sonu <sonu(a)online.nospam> wrote: >> >> >> >> >> >> >Ok, I added the _T() abound the Characters in .ReverseFind( '\\' ) ); >> >> >> > >> >> >> >But that is not the problem... The problem I am having is that the Amimation >> >> >> >does not run... >> >> >> >I see a stationary hourglass. But it does not move.... If the user refreshes >> >> >> >the window, the stationary hourglass disappears and the ctrl that is about to >> >> >> >get populated with the search results from the background process kindof >> >> >> >becomes blank.. which leads the user to fear that the program has crashed, >> >> >> >which is not the case... it's just that the animation is not working. >> >> >> >Please note that this same code used to work when compiled in the older >> >> >> >versions of VS. >> >> >> > >> >> >> >Thanks >> >> >> >Srishti >> >> >> > >> >> >> > >> >> >> > >> >> >> >"Joseph M. Newcomer" wrote: >> >> >> > >> >> >> >> 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 >> >> >> >> >> >> >> Joseph M. Newcomer [MVP] >> >> >> email: newcomer(a)flounder.com >> >> >> Web: http://www.flounder.com >> >> >> MVP Tips: http://www.flounder.com/mvp_tips.htm >> >> >> >> >> Joseph M. Newcomer [MVP] >> >> email: newcomer(a)flounder.com >> >> Web: http://www.flounder.com >> >> MVP Tips: http://www.flounder.com/mvp_tips.htm >> >> >> Joseph M. Newcomer [MVP] >> email: newcomer(a)flounder.com >> Web: http://www.flounder.com >> MVP Tips: http://www.flounder.com/mvp_tips.htm >> Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
First
|
Prev
|
Pages: 1 2 3 4 Prev: converting vc++2005 project to VC++2008 Next: OnActivateView problem |