Help

This is a discussion on Help within the Windows Programming forums, part of the Platform Specific Boards category; Someone tell me how come can't I pass an 'int' to the MessageBox()'s 2nd parameter??...

  1. #1
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542

    Help

    Someone tell me how come can't I pass an 'int' to the MessageBox()'s 2nd parameter??
    what does signature stand for?

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Is that a trick question? Because it takes a char* numbskull! j/k

    Here, add this to your toolbox:

    Code:
    int Alert(int style, const char * message, ...)  {
      char output[strlen(message) + 1024];
      va_list p;
      va_start(p, message);
      vsprintf(output, message, p);
      return MessageBox(NULL, "Notification: ", output, style);
      }
    
    int Alert(const char * message, ...) {
      char output[strlen(message) + 1024];
      va_list p;
      va_start(p, message);
      vsprintf(output, message, p);
      return MessageBox(NULL, "Notification: ",  output, MB_OK);
      }
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    btq
    btq is offline
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161
    how come can't I pass an 'int' to the MessageBox()'s 2nd parameter
    because it wants a LPCSTR..
    use itoa() to convert the integer to a char* string first and then pass it..

    /btq
    ...viewlexx - julie lexx

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21