|
From: Jan M. <jan...@vo...> - 2008-04-08 15:06:19
|
Hello,
Bellow is a code example of some window creating.
I would like to know.
I am not sure because newbie to this window stuff and always seemed it to me
somehow like a mystery.
So let's say I want to have another type of the cursor. So can I put the
type as a parameter to WinMain function?
When I tried write down WinMain() like
WinMain()
without the parameters it shows errors about conflict with the prototype.
And if what data type should it be.
It is a member of some structure wc.Cursor but i am not sure what to deal
with this.
Thanks a lot
Jan Mura
jan...@vo...
The code:
#include<windows.h>
#include "main.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
const char g_szClassName[] = "TheWindow";
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;
/*fill out the member of a window class */
wc.cbSize = sizeof(WNDCLASSEX); /* the size of the structure */
wc.style = 0; /* style of the class, usually can be set to 0 */
wc.lpfnWndProc = WndProc; /- pointer to the window procedure - see
function WndProc() */
wc.cbClsExtra = 0; /* amount of extra data allocated, usually set to
0 */
wc.cbWndExtra = 0; /* amount of data allocated for the type of a
window, usually set to 0 */
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); /* big icon */
wc.hCursor = LoadCursor(NULL, IDC_ARROW); /* type of the cursor
shown */
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); /* color of the window */
wc.lpszMenuName = NULL; /* name of a menu resources */
wc.lpszClassName = g_szClassName; /* the name to identify the class
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); /* small icon */
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
|