Re: [Dev-C++] Simple window in Dev C++
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2005-06-11 22:08:52
|
Are you sure that style is a pointer?
And are you sure about MassageBox. Note the spelling. MessageBox is alot
better :)
/Per W
On Sat, 11 Jun 2005, Infinity wrote:
> 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 ap=
pears 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/xxlad=
sl
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: NEC IT Guy Games. How far can you sho=
tput
> a projector? How fast can you ride your desk chair down the office luge t=
rack?
> If you want to score the big prize, get to know the little guy.
> Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|