Game Development Reference
In-Depth Information
wc.lpszClassName = "Hello";
Once we have described our window, we need to register it with Win-
dows. This is done with the RegisterClass function that takes a
pointer to a WNDCLASS structure. This function returns 0 upon failure.
if(!::RegisterClass(&wc))
Creating and Displaying the Window
After we have registered a WNDCLASS variable with Windows, we can
create a window based on that class description. We can refer to the
WNDCLASS structure that describes the window that we want to create
by the class name we gave it— lpszClassName . The function we use
to create a window is the CreateWindow function, which is declared
as follows:
HWND CreateWindow(
LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HANDLE hInstance,
LPVOID lpParam
);
lpClassName —The name (C string) of the registered WNDCLASS
structure that describes the window that we want to create. Pass in
the class name of the WNDCLASS we want to use for the creation of
this window.
lpWindowName —The name (C string) that we want to give our
window; this is also the name that appears in the window's caption
bar.
dwStyle —Defines the style of the window. WS_OVERLAPPED-
WINDOW , which we use in the Hello World sample, is a combination
of several flags: WS_OVERLAPPED , WS_CAPTION , WS_SYSMENU ,
WS_THICKFRAME , WS_MINIMIZEBOX , and WS_MAXIMIZEBOX .
The names of these flags describe the characteristics of the win-
dow that they produce. See the MSDN library for the complete list
of styles.
x —The x position at the top-left corner of the window relative to
the screen
Search WWH ::




Custom Search