easy question on MessageBox

Posted on 2004-09-26
Last Modified: 2013-11-20
How can i use the MessageBox to print something like this?

MessageBox("You Pressed %c", pressedchar);
Question by:vikasgkutty
  • 2
  • 2
  • 2
LVL 55

Accepted Solution

Jaime Olivares earned 25 total points
ID: 12155399
You can't do this, but have a look to this utility function:

Author Comment

ID: 12155469
But isnt there any other direct library functioon to do this

Author Comment

ID: 12155532
I think an easier way is like this

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

what do u say?
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 19

Expert Comment

ID: 12155536
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 ?
LVL 19

Expert Comment

ID: 12155538
Hehe, looks like you agree with that then ;)
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12155619
MessageBox will work only inside a CWnd derived object.
use AfxMessageBox() instead.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 111
bigDiff challenge 17 124
how to split multiple lines delimiter : 8 109
Trying to run powershell  in a batch file. How do I do this? 8 105
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question ( here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question