Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display popup in Win32 Console Application

Tags:

c++

winapi

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.

like image 889
Tom J Muthirenthi Avatar asked Mar 19 '14 09:03

Tom J Muthirenthi


2 Answers

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.

like image 173
Ben Avatar answered Sep 19 '22 14:09

Ben


#include <windows.h> 

int main() { 
        MessageBox(NULL, L"The message", L"The caption", MB_OK);

        return 0; 
} 

remember to link with user32.lib