Let's take a look at the window redraw today, and before we start bragging, we're going to write a simple Win32 application in the way we mentioned in the previous blog post. The code is as follows:
#include <Windows.h>//First declare the message handler function Lresult CALLBACK Mywindowproc (HWND hwnd, UINT MSG, WPARAM WPARAM, LPA
RAM LParam); Entry point int CALLBACK WinMain (hinstance hinstance, hinstance hprvinstance, LPSTR Lpcommandl
ine, int cmdshow) {wchar* CLN = L "MyApp";
Design window class Wndclass WC = {};
Wc.hinstance = hinstance;
Wc.lpszclassname = CLN;
Wc.lpfnwndproc = Mywindowproc;
Registration window class registerclass (&WC);
Create window HWND hmainwind = CreateWindow (CLN, L "Draw Window", Ws_overlappedwindow, 450, MB, NULL, NULL, h
Instance, NULL);
Display window if (hmainwind = NULL) return 0;
ShowWindow (Hmainwind,sw_normal);
message loop msg msg; while (GetMessage (&msg,null,0,0)) {translatemessage (&msg);
DispatchMessage (&MSG);
return 0; }//Window message Handler lresult CALLBACK Mywindowproc (HWND hwnd, UINT MSG, WPARAM WPARAM, LPARAM LPARAM) {SWITC
H (msg) {case wm_paint:break;
Case Wm_destroy:postquitmessage (0);//exit program return 0;
Default:return DefWindowProc (Hwnd,msg,wparam,lparam); }
}
This program can be normal operation, we first to run, to see what effect, of course, no effect, because it is just a blank window.