Re: MessageBox Error

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 06/11/04


Date: Thu, 10 Jun 2004 21:29:35 -0400

Don't use sprintf; Use CString::Format. sprintf is one of those quaint calls that rarely
or never should appear in an MFC program.
                                        joe

On 10 Jun 2004 17:04:29 -0700, jakir@coolgoose.com (Jakir) wrote:

>The MessageBox parameter requires char*. Just format the string using sprintf
>and pass that parameter to MessageBox function.
>
>Regards
>Jakir
>"JLO" <geomapa@cybercable.net.mx> wrote in message news:<en2$TYxTEHA.544@TK2MSFTNGP11.phx.gbl>...
>> hello.
>> When i try to get a message from a variable information i get this message
>> error C2664: 'MessageBoxA' : cannot convert parameter 1 from 'int'
>> to 'const char *'
>>
>> here is part of my code
>>
>> int PointsNumber(0);
>> MessageBox(PointsNumber, "Information");
>>
>> thanks for your help

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: MessageBox Error
    ... sprintf() is a C-Runtime library function. ... I feel we can avoid having an extra level if we don't use CString and know ... > or never should appear in an MFC program. ...
    (microsoft.public.vc.mfc)
  • Re: Grab MDI Background Color
    ... MVP - Visual Basic ... (please post replies to the newsgroup) ...
    (microsoft.public.vb.winapi)