Thread: Help

  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,820
    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,820
    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,820
    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,820
    Your welcome
    Woop?

Popular pages Recent additions subscribe to a feed