DoEvent() in Windows and Linux errors

113 views Asked by At

I want to write a function like DoEvents() in C++.

I found DoEvents equivalent for C++? and In C/C++, which function is like DoEvents( ).

Here is the code:

void DoEvents()
{
    MSG msg;           // Error 1
    
    while ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE ) )   //Error 2
    {
        if ( GetMessage(&msg, NULL, 0, 0))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        else
            break;
    }
}

I have two questions:

Q1. What is the equivalent of DoEvent() in Linux?

Q2. I got errors when I try to use it on windows using Qt creator.

Error1 : unknown type name 'MSG'

Error2 : use of undeclared identifier'PM_NOREMOVE'

Any Help, please?

0

There are 0 answers