How do I display a popup window in a Win32 Console application in Microsoft Visual C++? This is for building a drowsiness detection system using OpenCv.
MessageBox( nullptr, TEXT( "The driver is sleeping!!" ), TEXT( "Message" ), MB_OK );
Make sure to include windows.h. The thread you call this on will block.
You can just call something like :-
MessageBoxA(NULL, "Wake Up!", "Alert!", MB_OK | MB_ICONEXCLAMATION);
You have to include for this to work.
These APIS still work from a console app.
#include <windows.h>
int main() {
MessageBox(NULL, L"The message", L"The caption", MB_OK);
return 0;
}
remember to link with user32.lib
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.