Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to force screen update?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to force screen update?

 Post Reply Post Reply
Author
Message
hakoar View Drop Down
Groupie
Groupie
Avatar

Joined: 06 August 2008
Location: Finland
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote hakoar Quote  Post ReplyReply Direct Link To This Post 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?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2009 at 12:59am

Hi,

 
Add some AfxGetApp()->PumpMessage();
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2009 at 5:54am
Multithreading ftw!
PokerMemento - http://www.pokermemento.com/
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2009 at 6:29am
Originally posted by znakeeye znakeeye wrote:

Multithreading ftw!


DoEvents ftw

Codejock support
Back to Top
hakoar View Drop Down
Groupie
Groupie
Avatar

Joined: 06 August 2008
Location: Finland
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote hakoar Quote  Post ReplyReply Direct Link To This Post 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...

Back to Top
hakoar View Drop Down
Groupie
Groupie
Avatar

Joined: 06 August 2008
Location: Finland
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote hakoar Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2009 at 6:37am
Originally posted by znakeeye znakeeye wrote:

Multithreading ftw!


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?
 
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.061 seconds.