Game Development Reference
In-Depth Information
// parameters.
if(!InitWindowsApp(hInstance, nShowCmd))
{
::MessageBox(0, "Init - Failed", "Error", MB_OK);
return 0;
}
// Once our application has been created and
// initialized we enter the message loop. We
// stay in the message loop until a WM_QUIT
// message is received, indicating the application
// should be terminated.
return Run(); // enter message loop
}
bool InitWindowsApp(HINSTANCE instanceHandle, int show)
{
// The first task to creating a window is to describe
// its characteristics by filling out a WNDCLASS
// structure.
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = instanceHandle;
wc.hIcon = ::LoadIcon(0, IDI_APPLICATION);
wc.hCursor = ::LoadCursor(0, IDC_ARROW);
wc.hbrBackground =
static_cast<HBRUSH>(::GetStockObject(WHITE_BRUSH));
wc.lpszMenuName = 0;
wc.lpszClassName = "Hello";
// Then we register this window class description
// with Windows so that we can create a window based
// on that description.
if(!::RegisterClass(&wc))
{
::MessageBox(0, "RegisterClass - Failed", 0, 0);
return false;
}
// With our window class description registered, we
// can create a window with the CreateWindow function.
// Note, this function returns a HWND to the created
// window, which we save in MainWindowHandle. Through
// MainWindowHandle we can reference this particular
// window we are creating.
MainWindowHandle = ::CreateWindow(
"Hello",
"Hello",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
Team-Fly ®
Search WWH ::




Custom Search