Reputation: 13
How can I show the file name and some string in a messagebox?
I use this code:
wcout<<L"The File Path: [ "<<filename<<" ] Is Wrong";
but now I want to use a messagebox instead of wcout
.
MessageBoxW(NULL,L"The File Path: [ "+filename+L" ] Is Wrong" , (LPCWSTR)L"File Content", MB_OK);
Upvotes: 0
Views: 103
Reputation: 1
You can use std::wostringstream
to format the text for your messagebox:
std::wostringstream msg;
msg << L"The File Path: [" << filename << L"] Is Wrong";
And pass msg.str().c_str()
to the messagebox
MessageBox(NULL,msg.str().c_str(),L"File open error",MB_ICONERROR | MB_OK);
Upvotes: 1