Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Searching someting like "CVI ProcessSystemEvents" in MFC

Hallo,

Is there any functionality like the CVI function ProcessSystemEvents in the
MFC, or have I to use multi threading?


thanks
Babak
0 Kudos
Message 1 of 3
(3,061 Views)
Babak,

The MFC analog to CVI ProcesSystemEvents is a message loop. Check out the MSDN article titled "Idle Loop Processing" for more information. The URL for the online MSDN is below.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Idle_Loop_Processing.asp

David Rohacek
National Instruments
0 Kudos
Message 2 of 3
(3,061 Views)
It sounds like you're looking for something like VB's DoEvents. One way to do this in MFC is something like this:

void CMyClass::DoEvents()
{
MSG msg;
while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (!::AfxGetThread()->PumpMessage())
return;
}
}

You can find some additional useful information from these Microsoft Knowledge Base articles:

Q74042 - HOWTO: How to Use PeekMessage() Correctly in Windows
Q99999 - INFO: Background Processing in an MFC Application

- Elton
0 Kudos
Message 3 of 3
(3,061 Views)