1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

windows application

Discussion in 'C' started by Colin Mac, Feb 4, 2007.

  1. Colin Mac

    Colin Mac New Member

    Joined:
    Jan 21, 2007
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    I'm reading a tutorial on creating Windows applications
    http://www.winprog.org/tutorial/start.html
    It doesn't give any compiler specific insructions on how to compile this example, only that is should be compiled as a c file.

    Code:
    #include <windows.h>
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
        LPSTR lpCmdLine, int nCmdShow)
    {
        MessageBox(NULL, "Goodbye! cruel World", "Note", MB_OK);
        return 0;
    }
    I compiled the code in Visual Studio C++ and when I ran the program, I got this:
    [​IMG]

    How could I compile the code in Visual Studio C++ to get the proper text in the code displayed?
     
  2. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    Worked for me. Maybe you have some locale issues.
    [​IMG]
     
  3. Colin Mac

    Colin Mac New Member

    Joined:
    Jan 21, 2007
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    Thanks DaWei.

    I have tried using the gcc compiler from command prompt and it worked, except a console of window appears along with that window at the same time when the program is executed.
     
  4. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    There's a command line option to prevent the console window from showing. Don't know which gcc you're using (what invokes it, if other than you), so can't comment further.
     
  5. Colin Mac

    Colin Mac New Member

    Joined:
    Jan 21, 2007
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    Yes, there is.

    If anyone reading is interested you need to add this to the compile command:

    -Wl,-subsystem,windows


    Regards.
     

Share This Page