Thread: Word count in an EDIT box?

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question Word count in an EDIT box?

    I have already got the words counted, but how do I place an int in a MessageBox?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Use sprintf.

    Code:
    int num = 5;
    TCHAR *string;
    sprintf(string, TEXT("The int is %d"), num);
    MessageBox(NULL, string, TEXT("INTEGER"), MB_OK);
    Does this help?

    --Garfield
    1978 Silver Anniversary Corvette

  3. #3
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    CORRECTION:

    I think you'll have to use wsprintf due to the fact that TCHAR *string could be a pointer to wide characters.
    1978 Silver Anniversary Corvette

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    int word_count; // you fill in

    char output[100];

    sprintf( output, "The Word Count Is %i !", word_count);

    MessageBox(hwnd, output, TEXT("Official Word Count"), 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;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating an Edit Box (Subclassing)
    By csonx_p in forum Windows Programming
    Replies: 9
    Last Post: 05-05-2008, 06:36 AM
  2. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. edit box
    By beene in forum Windows Programming
    Replies: 3
    Last Post: 11-11-2006, 04:40 AM
  5. EDIT box int?(PLEASE ANSWER)
    By SyntaxBubble in forum Windows Programming
    Replies: 5
    Last Post: 11-07-2001, 12:02 AM