Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2106
  • Last Modified:

Is there an equivalent in MFC of DoEvents in VB, doEvents in Java

We need to know what is the MFC Visual C++ equivalent of DoEvents() in Visual Basic or doEvents in Java.

The use of CEvent seems to be quite a heavy solution, just for allowing from time to time the operating system to get hand for executing other tasks.

Thanks for kind reply.
0
rgimilio
Asked:
rgimilio
1 Solution
 
Roshan DavisCommented:
This will do

int DoEvents()
{
      MSG msg;
      int nCount = 0;

      while ( ::PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE) )
      {
            nCount++;
            ::TranslateMessage(&msg);
            ::DispatchMessage(&msg);
      }

      return nCount;
}

Good LUck
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now