Advertisement

A simple message box program

Started by August 04, 2002 05:07 PM
6 comments, last by Mikey21 22 years, 4 months ago
I''m trying my hand at windows programming. Right now I''m just trying to create a simple message box so I can get the basics down. For some reason, my compiler won''t build it. Here''s the code... #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <windowsx.h> int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { MessageBox(NULL, "yo yo yo check this out!" , "My First Windows Program" ,MB_OK); return 0; } If there''s anything wrong with this code, please let me know. I copied it right out of a book, so I don''t see why there would be a problem. I''m using Microsoft Visual C++ 6.0 and running Windows ME if that means anything. thanx
When you started a new project, did you select ''Win32 Application'' and not ''Win32 Console Application'' ?
Advertisement
make sure that you created a Win32 application and not console or MFC.


i dont see any prob wit ur code, but i dont have my compiler wit me so i have to rely on memory.

try this code and see if it works for u

#define WIN32_LEAN_AND_MEAN#include <windows.h>// windowsx.h is not neededint WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,                   LPSTR lpCmdLine, int nCmdShow){      MessageBox(NULL, " Quit yo jibba jabba foo ",                       "Message from Mr T. ",                       MB_OK);      return 0;} 

Microsoft Corporation 1985 - 2002 C
post what the errors are first

"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T
This is the error I get...

Fatal error c1010: unexpected end of file while looking for precompiled header directive.

What does this mean and how can I fix it?
try this
#include "stdafx.h" on the top of your .cpp file.

or you can just remove pre-compiler headers from your project settings.

Its my duty, to please that booty ! - John Shaft
Advertisement
By default a Visual C++ 6 Win 32 API project does not use precompiled headers. Maybe you accidentally created a MFC project or something?.

Thanx guys! I finally got the thing to work and have even made progress since then.

Thanks for the adivce.

This topic is closed to new replies.

Advertisement