![]() |
How to force screen update? |
Post Reply
|
| Author | |
hakoar
Groupie
Joined: 06 August 2008 Location: Finland Status: Offline Points: 21 |
Post Options
Thanks(0)
Quote Reply
Topic: How to force screen update?Posted: 06 May 2009 at 5:37am |
|
Hi,
I have an application that does long processing and shows that progress in a progress bar in the statusbar area. Everything works and get's updated until I "Alt+Tab" to an other application while processing continues. When I switch back to my processing application, the progress bar or the whole client area doesn't get updated until the processing is complete? How can I force the screen update within the loop? I have tried following without any luck: --- ((CMainFrame*)AfxGetMainWnd())->m_wndProgCtrl.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN); ((CMainFrame*)AfxGetMainWnd())->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN); --- Any suggestions? |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 May 2009 at 12:59am |
|
Hi, Add some AfxGetApp()->PumpMessage();
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
znakeeye
Senior Member
Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 May 2009 at 5:54am |
|
Multithreading ftw!
|
|
|
PokerMemento - http://www.pokermemento.com/
|
|
![]() |
|
ABuenger
Newbie
Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 May 2009 at 6:29am |
DoEvents ftw ![]() |
|
|
Codejock support
|
|
![]() |
|
hakoar
Groupie
Joined: 06 August 2008 Location: Finland Status: Offline Points: 21 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 May 2009 at 6:34am |
|
Hi,
This "makes more" than just a window update happening .Hope there would be a method to just force the current view to be re-freshed during the run.... This is a database app that processes in a loop "something" and updates the progressbar when progressing... |
|
![]() |
|
hakoar
Groupie
Joined: 06 August 2008 Location: Finland Status: Offline Points: 21 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 May 2009 at 6:37am |
Hi, At the moment I don't want to start learning threading implementations. I'm fine with the current, except that the window update problem. It should be solvable somehow without threads. Sorry my ignorance but what the "ftw" stands for? |
|
![]() |
|
znakeeye
Senior Member
Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Quote Reply
Posted: 15 May 2009 at 3:20am |
|
ftw = "for the win".
From experience I know that a progress bar cannot be updated when performing CPU intensive operations unless you run the lengthy operation in another thread!
I've posted this link before. You should read it!
|
|
|
PokerMemento - http://www.pokermemento.com/
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |