Thread: Small MessageBox problem

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937

    Small MessageBox problem

    How could I display in a messagebox the output of the function gethostbyname("http://www.whatever.com") ?
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

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

    Lightbulb Try this...

    First, get the hostname with the function. Make sure that a variable is set like this(Be sure to include stdio.h for sprintf()):

    name=gethostbyname(blah, blah);

    Then, create a char:

    char newName[200];

    sprintf(newName, "%d", name);

    MessageBox(hwnd, newName, "Title", MB_OK | MB_ICONINFORMATION);

    I hope it helps!
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Small problem
    By xViBeSz in forum C Programming
    Replies: 5
    Last Post: 04-26-2009, 11:02 AM
  2. Small Problem with double and integer adding?
    By Nathan the noob in forum C++ Programming
    Replies: 5
    Last Post: 03-28-2009, 04:16 PM
  3. Visual C++ small problem
    By gadu in forum C++ Programming
    Replies: 0
    Last Post: 03-10-2009, 10:45 PM
  4. Small problem with this array...
    By Merholtz in forum C Programming
    Replies: 7
    Last Post: 11-03-2008, 04:16 PM
  5. Help with a small problem (beginner)
    By piffo in forum C Programming
    Replies: 13
    Last Post: 09-29-2008, 04:37 PM