|
From: Infinity <inf...@ne...> - 2005-06-11 21:29:06
|
I tried to make a simple window using this code
#include <windows.h>
// Prototype of a function with Windows procedurs
LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
// Window class name
static char gszClassName[]=3d"MyClass";
// main()
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX WndClass;
HWND hwnd;
MSG Msg;
// Registration of a window class
WndClass.cbSize=3dsizeof (WNDCLASSEX);
WndClass.style=3dNULL;
WndClass.lpfnWndProc=3dWindowProcedure;
WndClass.cbClsExtra=3d0;
WndClass.cbWndExtra=3d0;
WndClass.hInstance=3dhInstance;
WndClass.hIcon=3dLoadIcon(NULL, IDI_APPLICATION);
WndClass.hCursor=3dLoadCursor(NULL, IDC_ARROW);
WndClass.hbrBackground=3d(HBRUSH)(COLOR_WINDOW);
WndClass.lpszMenuName=3dNULL;
WndClass.lpszClassName=3dgszClassName;
WndClass.hIconSm=3dLoadIcon(NULL, IDI_APPLICATION);
// Class registration check
if (!RegisterClassEx(&WndClass))
{
MassageBox(0,"Registration failed","Error", MB_ICONSTOP|MB_OK);
}
// Creating a window
hwnd=3dCreateWindowEx(WS_EX_STATICEDGE,
gszClassName,
"Window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
500, 400,
NULL, NULL,
hInstance,
NULL);
// Window creation check
if (hwnd=3d=3dNULL)
{
MessageBox (0, "Window creation failed","Error", MB_ICONSTOP|MB_OK);
}
// Showing a window
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
// message loop
while (GetMessage(&Msg, NULL, 0, 0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
UnregisterClass("MyClass",hInstance);
return Msg.wParam;
}// END
// Function with Windows procedurs
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message) {
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
}
And I got the following error:
In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
23 [Warning] converting to non-pointer type `UINT' from NULL
39 `MassageBox' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
C:\Dev-Cpp\Makefile.win [Build Error] [main.o] Error 1
Help, Please!
--
Naru=e8ite svoj XXLadsl - instalacija i modem i dalje za samo 1 kn!
Postanite i vi korisnik ultra brzog Interneta! http://www.iskon.biz/xxladsl
|