Click here to Skip to main content
15,920,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Serialization [modified] Pin
Sarath C28-Jun-06 0:54
Sarath C28-Jun-06 0:54 
AnswerRe: Serialization Pin
bob1697228-Jun-06 3:25
bob1697228-Jun-06 3:25 
GeneralRe: Serialization Pin
ovidiucucu28-Jun-06 8:22
ovidiucucu28-Jun-06 8:22 
GeneralRe: Serialization Pin
bob1697228-Jun-06 10:24
bob1697228-Jun-06 10:24 
GeneralRe: Serialization [modified] Pin
ovidiucucu29-Jun-06 2:30
ovidiucucu29-Jun-06 2:30 
QuestionPeeking into the message queue of another thread Pin
Phil.Benson27-Jun-06 23:54
professionalPhil.Benson27-Jun-06 23:54 
AnswerRe: Peeking into the message queue of another thread Pin
Sarath C28-Jun-06 0:47
Sarath C28-Jun-06 0:47 
GeneralRe: Peeking into the message queue of another thread Pin
Phil.Benson28-Jun-06 1:36
professionalPhil.Benson28-Jun-06 1:36 
No, I have tried that and it does not work. The PeekMessage (I think) is still looking in the current threads message queue (i.e. the worker thread). This is not the result I need.

I have tried also the following:

BOOL CMainFrame::FudgeForceRedrawOfMainWindow(){


MSG msg;
while (::PeekMessage(&msg, NULL, // pump message until none
NULL, NULL, PM_NOREMOVE)) // are left in the queue
{
AfxGetThread()->PumpMessage();
}
return TRUE;
}

A function to see if there are any messages pending in the App´s message queue

BOOL CMainFrame::IsMessageQueueEmpty(){

// QS_ALLINPUT
// ***********
DWORD dwState = GetQueueStatus(QS_ALLINPUT);

if(HIWORD(dwState) == QS_ALLEVENTS){
return FALSE;
}

// Nothing of interest
// ******************
return TRUE;
}

Calling this function in my worker thread instead of ::PeekMessage(....) i.e. in the ThreadProc

Changed the structure passed to include a CMainFrame pointer pxFrame

...
case WAIT_TIMEOUT:
while(!pxFrame->IsMessageQueueEmpty()){
pxFrame->FudgeForceRedrawOfMainWindow();
}
break;

...

When called from the tread, the FudgeForceRedrawOfMainWindow() function never has any messages in the queue (in the PeekMessage(...) and therefore the PumpMessage() is never called.


HOWEVER if I call the FudgeForceRedrawOfMainWindow()in the same thread as the MainApp ( in lengthy interations) it works fine!

I´m a bit stumped about this....



bum... and I thought I´d got rid of all the bugs Frown | :(
GeneralRe: Peeking into the message queue of another thread [modified] Pin
Justin Tay28-Jun-06 2:39
Justin Tay28-Jun-06 2:39 
GeneralRe: Peeking into the message queue of another thread Pin
Phil.Benson28-Jun-06 2:54
professionalPhil.Benson28-Jun-06 2:54 
GeneralRe: Peeking into the message queue of another thread [modified] Pin
Justin Tay28-Jun-06 3:02
Justin Tay28-Jun-06 3:02 
GeneralRe: Peeking into the message queue of another thread Pin
Phil.Benson28-Jun-06 3:29
professionalPhil.Benson28-Jun-06 3:29 
GeneralRe: Peeking into the message queue of another thread Pin
Justin Tay28-Jun-06 3:38
Justin Tay28-Jun-06 3:38 
GeneralRe: Peeking into the message queue of another thread Pin
Phil.Benson28-Jun-06 5:33
professionalPhil.Benson28-Jun-06 5:33 
QuestionDatabase error in C++ Pin
aSoundMind27-Jun-06 23:29
aSoundMind27-Jun-06 23:29 
Questionanother kind of linker error Pin
Desmo1627-Jun-06 23:25
Desmo1627-Jun-06 23:25 
AnswerRe: another kind of linker error Pin
_AnsHUMAN_ 27-Jun-06 23:28
_AnsHUMAN_ 27-Jun-06 23:28 
AnswerRe: another kind of linker error Pin
Cedric Moonen27-Jun-06 23:33
Cedric Moonen27-Jun-06 23:33 
AnswerRe: another kind of linker error Pin
Sarath C27-Jun-06 23:41
Sarath C27-Jun-06 23:41 
QuestionMessageBox French Pin
dungpapai27-Jun-06 23:04
dungpapai27-Jun-06 23:04 
AnswerRe: MessageBox French Pin
Cedric Moonen27-Jun-06 23:21
Cedric Moonen27-Jun-06 23:21 
AnswerRe: MessageBox French Pin
Sarath C27-Jun-06 23:26
Sarath C27-Jun-06 23:26 
AnswerRe: MessageBox French Pin
FarPointer27-Jun-06 23:26
FarPointer27-Jun-06 23:26 
QuestionHTML Help Workshop from the Command Line [modified] Pin
Joel Holdsworth27-Jun-06 22:35
Joel Holdsworth27-Jun-06 22:35 
AnswerRe: HTML Help Workshop from the Command Line Pin
Sarath C28-Jun-06 1:07
Sarath C28-Jun-06 1:07 

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.