Game Development Reference
In-Depth Information
lpfnWndProc —Pointer to the window procedure function. This is
how you associate your window procedure function with a window.
Thus, the windows that are created based on the same WNDCLASS
instance share the same window procedure. The window procedure
function is explained in the section titled “The Window
Procedure.”
wc.lpfnWndProc = WndProc;
cbClsExtra and cbWndExtra —These are extra memory slots
that you can use for your own purpose. Our Hello World program
does not require any extra space and therefore sets both of these
to 0.
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
hInstance —This field is a handle to our application instance.
Recall that the application instance handle is originally passed in
through WinMain .
wc.hInstance = instanceHandle;
hIcon —Here you specify a handle to an icon to use for the win-
dows created using this window class. There are several built-in
icons to choose from. See the MSDN library for details.
wc.hIcon = ::LoadIcon(0, IDI_APPLICATION);
hCursor —Similar to hIcon , here you specify a handle to a cursor
to use when the cursor is over the window's client area. Again,
there are several built-in cursors. See the MSDN library for details.
wc.hCursor = ::LoadCursor(0, IDC_ARROW);
hbrBackground —This field is used to specify the background
color of the client area of the window. In our sample code we call
the function GetStockObject , which returns a handle to a brush
of the color that we specified. See the MSDN library for other
types of built-in brushes.
wc.hbrBackground =
static_cast<HBRUSH>(::GetStockObject(WHITE_BRUSH));
lpszMenuName —Specifies the window's menu. We have no menu
in our application, so we set this to 0.
wc.lpszMenuName = 0;
lpszClassName —Specifies the name of the window class struc-
ture that we are creating. This can be anything you want. In our
application, we named it “Hello.” The name is simply used to iden-
tify the class structure so that we can reference it later.
Search WWH ::




Custom Search