谁能帮我注释下这段代码。初学者谢谢大家帮忙啦

来源:百度知道 编辑:UC知道 时间:2024/06/15 20:13:58
#include <windows.h>

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("HelloWin") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;

wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;

if (!RegisterClass (&wndclass))
{

#include <windows.h>

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("HelloWin") ; 显示在窗口标题栏的文字
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;

wndclass.style = CS_HREDRAW | CS_VREDRAW ; 窗口风格,关于重绘的,新手照抄就行,不用理解。
wndclass.lpfnWndProc = WndProc ; 窗口回调函数,当有消息来的时候就发给这个函数。
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ; 程序运行时的句柄
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; 程序的图标,
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; 鼠标的形状,当鼠标在窗口范围内时。
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ; 窗口的背景色
wndclass.lpszMenuName = NULL ; 窗口的菜单,无
wndclass.lpszClassName = szAppName ; 向系统注册一个应用程序的名字

if (!RegisterClass (&wndclass)) 注册窗口类
{
MessageBox (NULL, TEXT