mardi 29 juin 2021

DoEvent() in Windows and Linux errors

I wanted to write a function DoEvent in C++. I found on DoEvents equivalent for C++?

and on 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.[Resolved] I got errors when I try to use it on windows using Qt creator. resolved by including #include <Windows.h>

Error1 : unknown type name 'MSG'

Error2 : use of undeclared identifier'PM_NOREMOVE'

Any Help, please?

Aucun commentaire:

Enregistrer un commentaire