1: Beginner's MFC framework

#include<windows.h>

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

int WINAPI WinMain(

HINSTANCE hinstance, // current application instance handle
HINSTANCE hPrevInstance, // the system handler application example of a front
PSTR szCmdLine, // points to this command line pointer
int nCmdShow) // flag determines the application window views
{
the HWND HWND;
the MSG MSG;
the WNDCLASS WC;
wc.style = 0; // window style, generally set to 0;
wc.lpfnWndProc = the WndProc; // pointer to the window function;
wc.cbClsExtra = 0; // reserved the extension member is generally set to 0;
wc.cbWndExtra = 0; // reserved extension member, is generally set to 0;
wc.hInstance = hInstance; // associated with the application window class instance handle
wc.hIcon = LoadIcon (NULL, IDI_WINLOGO); // window icon handle
wc.hCursor = LoadCursor (NULL, IDC_ARROW) ; // window cursor handle
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); // window background color brush handle
wc.lpszMenuName = NULL; // window menu resource name
wc.lpszClassName = "MyMFC"; // this window class name

RegisterClass(&wc);


hwnd=CreateWindow(
TEXT("MyMFC"),        //窗口类的名称
TEXT("This is my first MFC!"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hinstance,
NULL
);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}

return msg.wParam;


}
LRESULT CALLBACK WndProc(HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lparam
)
{
switch(message)
{
case WM_PAINT:
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;

}
return DefWindowProc(hwnd,message,wParam,lparam);
}

Guess you like

Origin www.cnblogs.com/jianmoxiansheng-Guo/p/11225529.html