Link to home
Start Free TrialLog in
Avatar of vikasgkutty
vikasgkutty

asked on

easy question on MessageBox

How can i use the MessageBox to print something like this?

MessageBox("You Pressed %c", pressedchar);
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vikasgkutty
vikasgkutty

ASKER

But isnt there any other direct library functioon to do this
I think an easier way is like this

CString s;
s.Format("You pressed %c",PressedChar);
MessageBox(s);

what do u say?
Why don't you just do it the easy way, using a CString that is formatted with CString::Format (similar flags to printf), then pass this CString to the messagebox ?
Hehe, looks like you agree with that then ;)
MessageBox will work only inside a CWnd derived object.
use AfxMessageBox() instead.