Please take a look at this 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, "HELLO WORLD",
MB_OK MB_ICONEXCLAMATION);
return(0);
}
I get one error trying to compile it.
Anyone know why?
your call to MessageBox is screwed up, look at the API docs, you''re missing the window title and there should be a | between the two MB_ parameters.
MessageBox(NULL, "hello world", "hello world", MB_OK | MB_ICONEXCLAMATION);
rtry that, it should work
MessageBox(NULL, "hello world", "hello world", MB_OK | MB_ICONEXCLAMATION);
rtry that, it should work
Isn''t there anything missing between MB_OK and
MB_ICONEXCLAMATION ?
Try "+" or "|" ... or try just MB_OK...
And post the error string and code.
MB_ICONEXCLAMATION ?
Try "+" or "|" ... or try just MB_OK...
And post the error string and code.
[Hugo Ferreira][Positronic Dreams][]
"Somewhere, something incredible is waiting to be known."
- Carl Edward Sagan (1934 - 1996)
Cool, it works now.
Sorry I am new to the Windows API and I just changed it to exactly how it shows in the book and it works.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int ncmdshow)
{
MessageBox(NULL, "THERE CAN BE ONLY ONE!!!",
"MY FIRST WINDOWS PROGRAM",
MB_OK | MB_ICONEXCLAMATION);
return(0);
}
That''s how it shows it in TOTWGPG and it works.
Thanks again.
Sorry I am new to the Windows API and I just changed it to exactly how it shows in the book and it works.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int ncmdshow)
{
MessageBox(NULL, "THERE CAN BE ONLY ONE!!!",
"MY FIRST WINDOWS PROGRAM",
MB_OK | MB_ICONEXCLAMATION);
return(0);
}
That''s how it shows it in TOTWGPG and it works.
Thanks again.
you would want to create a window and a message handler.. otherwise you would be limited to programs which does one thing fast and then terminate.. if you put a loop in your current WinMain you would screw windows :-).. this is a good tutorial for creating a basic windows program:
http://www.peroxide.dk/download/tutorials/tut9/pxdtut9.htm
http://www.peroxide.dk/download/tutorials/tut9/pxdtut9.htm
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement