The easiest way to make a msgbox?

This is a discussion on The easiest way to make a msgbox? within the C++ Programming forums, part of the General Programming Boards category; What's the easiest way to make an messagebox, can I somehow just use the insert resource thing? (ctrl+r or insert-resource...) ...

  1. #1
    Unregistered
    Guest

    The easiest way to make a msgbox?

    What's the easiest way to make an messagebox, can I somehow just use the insert resource thing? (ctrl+r or insert-resource...) or do I actually have to write code for it myself..

    let's say I have the classical Hello World

    #include <iostream.h>

    int main()
    {
    cout << "Hello World";
    return 0;
    }

    how can I make this into a msgbox, can I use the insert resource, and in that case, how do I do it..

    thanks

  2. #2
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    MessageBox(NULL, "message box caption", "message box title", +MB_OK);
    }


    //this will create a message box with an ok button, you need to include windows.h to use the MessageBox function
    Monday - what a way to spend a seventh of your life

  3. #3
    Perverted unanimous's Avatar
    Join Date
    Oct 2001
    Posts
    336

    Post YES...

    The whole program is this:


    #include <windows.h>

    int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
    {
    MessageBox(NULL,"Put Message Here", "Put Title Here", MB_OK);

    return 0;
    }
    Give me a bad reputation!!!

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    ian, I noticed that you put a plus before MB_OK, was this just a mistake or does it have a real signifigance ? (I know that's spelt wrong...)

  5. #5
    31173 h4x0r gnu-ehacks's Avatar
    Join Date
    Nov 2001
    Posts
    556
    Remember, before you do this, make it a Win32 Application, and not a Win32 Console Application...I always here about people making this mistake, and it should be avoided.
    What will people say if they hear that I'm a Jesus freak?
    What will people do if they find that it's true?
    I don't really care if they label me a Jesus freak, there is no disguising the truth!

    Jesus Freak, D.C. Talk

    -gnu-ehacks

  6. #6
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    it can be a console app.
    you just need the windows.h header included.

    this will work
    Code:
    #include <windows.h>
    
    int main()
    {
     MessageBox(NULL, "Message", "Title", MB_OK);
     return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to make a Packet sniffer/filter?
    By shown in forum C++ Programming
    Replies: 2
    Last Post: 02-22-2009, 08:51 PM
  2. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  3. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM
  4. Question about atheists
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 08-11-2003, 11:50 AM
  5. Replies: 6
    Last Post: 04-20-2002, 06:35 PM

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