Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display message in windows dialogue box using "cout" - C++

Can a windows message box be display using the cout syntax?

I also need the command prompt window to be suppressed / hidden.

There are ways to call the messagebox function and display text through its usage, but the main constraint here is that cout syntax must be used.

cout <<  "message";

I was thinking of invoking the VB msgbox command in the cout output, but couldn't find anything that worked.

Any ideas?

like image 983
CheeseConQueso Avatar asked Nov 28 '22 00:11

CheeseConQueso


1 Answers

C++ streams work with console or file streams. Windows work on a more or less completely different paradigm, so the cout context isn't really a good one for working with this. You could probably completely mash up something that would end up more or less working, and looking more or less similar to this syntax, but it's not really worth it when you can just do:

MessageBox( NULL, message, "", MB_OK );

See the full docs on MessageBox for more info.

like image 90
Russell Newquist Avatar answered Feb 04 '23 21:02

Russell Newquist