The first step to Graphics PRogramming is to create a Window. Some keynotes on window creation:
Start from the template provided by Visual Studio
Although hInstance
is passed in in WinMain
, it’s better not to pass the hInstance
around. Instead, use GetModuleHandle
to get handle to module instance;
When filling out WNDCLASSEX
, two fields are required.
lpszClassName
&& lpfnWndProc
are the only MUST for WNDCLASSEX
.
Leave the other fields as in the template.
Avoid use 0 as mShowCmd
, since 0 meas SW_HIDE
.
PostQuitMessage
on WM_DESTROY
, and catch WM_QUIT
in main loop.
新闻热点
疑难解答