Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   windows application (http://www.go4expert.com/forums/windows-application-t2844/)

Colin Mac 4Feb2007 21:30

windows application
 
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:
http://i43.photobucket.com/albums/e3...2/untitled.jpg

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

DaWei 5Feb2007 00:30

Re: windows application
 
Worked for me. Maybe you have some locale issues.
http://www.daweidesigns.com/images/mbox.jpg

Colin Mac 5Feb2007 02:45

Re: windows application
 
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.

DaWei 5Feb2007 03:06

Re: windows application
 
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.

Colin Mac 5Feb2007 04:00

Re: windows application
 
Yes, there is.

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

-Wl,-subsystem,windows


Regards.


All times are GMT +5.5. The time now is 12:27.