Help

This is a discussion on Help within the C++ Programming forums, part of the General Programming Boards category; I just learned how to make message-boxes, heres the code: Code: #include <iostream.h> int main() { MessageBox(NULL, "Message", "Title", MB_OK); ...

  1. #1
    Banned
    Join Date
    May 2004
    Posts
    55

    Help

    I just learned how to make message-boxes,
    heres the code:

    Code:
    #include <iostream.h>
    int main()
    {
        MessageBox(NULL, "Message", "Title", MB_OK);
    }
    How do I do so the message-box comes up but not DOS?

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,805
    Well first you have to include <windows.h> and your main should look like this
    Code:
    #include <windows.h>
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
        LPSTR lpCmdLine, int nCmdShow)
    {
        MessageBox(NULL, "Message", "Title", MB_OK);
        return 0;
    }
    Woop?

  3. #3
    Banned
    Join Date
    May 2004
    Posts
    55
    It didn't worked, DOS is still coming up

    Code:
    #include <windows.h>
    #include <iostream.h>
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
        LPSTR lpCmdLine, int nCmdShow)
    {
        MessageBox(NULL, "Message", "Title", MB_OK);
        return 0;
    }
    Last edited by Noxir; 07-09-2004 at 02:54 PM.

  4. #4
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,805
    change your linker options to not create an console window and you should be golden
    Woop?

  5. #5
    Banned
    Join Date
    May 2004
    Posts
    55
    Ok thanks for help

  6. #6
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,805
    what compiler are you using?
    Woop?

  7. #7
    Banned
    Join Date
    May 2004
    Posts
    55
    I checked "lšnkare" (linker on swedish) and there it was "Don't open console window" thnx a lot

  8. #8
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,805
    Your welcome
    Woop?

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