Click here to Skip to main content
15,911,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Overflowing the Windows’s message Queue Pin
BobInNJ8-Jan-09 10:03
BobInNJ8-Jan-09 10:03 
GeneralRe: Overflowing the Windows’s message Queue Pin
David Crow8-Jan-09 10:13
David Crow8-Jan-09 10:13 
GeneralRe: Overflowing the Windows’s message Queue Pin
BobInNJ8-Jan-09 11:12
BobInNJ8-Jan-09 11:12 
QuestionRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz8-Jan-09 12:11
Roger Stoltz8-Jan-09 12:11 
GeneralRe: Overflowing the Windows’s message Queue Pin
Luc Pattyn8-Jan-09 13:21
sitebuilderLuc Pattyn8-Jan-09 13:21 
GeneralRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz8-Jan-09 22:30
Roger Stoltz8-Jan-09 22:30 
AnswerRe: Overflowing the Windows’s message Queue Pin
BobInNJ8-Jan-09 14:24
BobInNJ8-Jan-09 14:24 
GeneralRe: Overflowing the Windows’s message Queue Pin
Cedric Moonen8-Jan-09 20:27
Cedric Moonen8-Jan-09 20:27 
BobInNJ wrote:
Do you or anybody else see a problem with this approach?


Yes, with the repaint the window part. Depending on the way you plan to do this, this may causes problems because you can't access GUI objects from another thread than the one they were created in.
In fact, a much better approach is quite similar as what you did: keep your function as it is but remove the repaint the window part. Instead simply send a WM_PAINT message to your window that will force a redraw. In the OnPaint handler, you can then access the data you sent. Of course, there you also have to protect the access using critical sections.
If the repainting part is much slower than the run of the simulation, you can have another approach: don't send a WM_PAINT message in the ReportingMethod function but instead create a timer in your UI thread. Whenever your timer fires, you repaint your window.

Cédric Moonen
Software developer

Charting control [v1.5]
OpenGL game tutorial in C++

GeneralRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz8-Jan-09 22:54
Roger Stoltz8-Jan-09 22:54 
GeneralRe: Overflowing the Windows’s message Queue Pin
Cedric Moonen8-Jan-09 22:57
Cedric Moonen8-Jan-09 22:57 
GeneralRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz8-Jan-09 23:05
Roger Stoltz8-Jan-09 23:05 
GeneralRe: Overflowing the Windows’s message Queue Pin
Luc Pattyn9-Jan-09 1:31
sitebuilderLuc Pattyn9-Jan-09 1:31 
GeneralRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz9-Jan-09 1:44
Roger Stoltz9-Jan-09 1:44 
GeneralRe: Overflowing the Windows’s message Queue Pin
BobInNJ9-Jan-09 6:31
BobInNJ9-Jan-09 6:31 
GeneralRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz8-Jan-09 23:11
Roger Stoltz8-Jan-09 23:11 
AnswerRe: Overflowing the Windows’s message Queue Pin
Rolf Kristensen10-Jan-09 2:02
Rolf Kristensen10-Jan-09 2:02 
GeneralRe: Overflowing the Windows’s message Queue Pin
BobInNJ10-Jan-09 8:47
BobInNJ10-Jan-09 8:47 
GeneralRe: Overflowing the Windows’s message Queue Pin
Rolf Kristensen11-Jan-09 1:15
Rolf Kristensen11-Jan-09 1:15 
QuestionEdit control with HTML link Pin
sabapathy_808-Jan-09 5:00
sabapathy_808-Jan-09 5:00 
AnswerRe: Edit control with HTML link Pin
Iain Clarke, Warrior Programmer8-Jan-09 5:04
Iain Clarke, Warrior Programmer8-Jan-09 5:04 
GeneralRe: Edit control with HTML link Pin
sabapathy_808-Jan-09 5:14
sabapathy_808-Jan-09 5:14 
GeneralRe: Edit control with HTML link Pin
David Crow8-Jan-09 9:10
David Crow8-Jan-09 9:10 
GeneralRe: Edit control with HTML link Pin
sabapathy_809-Jan-09 6:20
sabapathy_809-Jan-09 6:20 
GeneralRe: Edit control with HTML link Pin
David Crow9-Jan-09 6:29
David Crow9-Jan-09 6:29 
GeneralRe: Edit control with HTML link Pin
sabapathy_809-Jan-09 7:47
sabapathy_809-Jan-09 7:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.