#include
#include
using namespace std;
Const string ProgramTitle="FUCK FUCK";
LRESULT a CALLBACK WinProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM) {
The RECT drawRect;
PAINTSTRUCT ps;
HDC HDC.
The switch (the message) {
In case the WM_PAINT:
{
HDC=BeginPaint (hWnd, & amp; Ps);
For (int n=0; N & lt; 20; N++) {
Int x=n * 20;
Int y=n * 20;
DrawRect={x, y, x + 100, y + 20};
DrawText (HDC, ProgramTitle c_str (), ProgramTitle. The length (), & amp; DrawRect, DT_CENTER);
}
EndPaint (hWnd, & amp; Ps);
} break;
Case WM_DESTROY: {
The PostQuitMessage (0);
} break;
}
Return DefWindowProc (hWnd, message, wParam, lParam);
}
The ATOM MyRegisterClass (HINSTANCE HINSTANCE) {
Modifed WNDCLASSEX wc.
Wc. CbSize=sizeof (WNDCLASS);
Wc. Style=CS_HREDRAW | CS_VREDRAW;
Wc. LpfnWndProc=(WNDPROC WinProc);
Wc. CbClsExtra=0;
Wc. CbWndExtra=0;
The wc. The hInstance=hInstance;
Wc. HIcon=NULL;
Wc. HCursor=LoadCursor (NULL, IDC_APPSTARTING);
Wc. HbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH);
Wc. LpszMenuName=NULL;
Wc. LpszClassName=ProgramTitle. C_str ();
Wc. HIconSm=NULL;
Return RegisterClassEx (& amp; Wc);
}
Bool InitInstance (HINSTANCE HINSTANCE, int nCmdShow) {
HWND HWND=CreateWindow (
ProgramTitle. C_str (),
ProgramTitle. C_str (),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT CW_USEDEFAULT,
640, 480,
NULL,
NULL,
HInstance,
NULL
);
If (hWnd==0) {
MessageBox (NULL, ""," ", MB_OK);
}
ShowWindow (hWnd, nCmdShow);
UpdateWindow (hWnd);
return 1;
}
Int WINAPI WinMain (HINSTANCE HINSTANCE, HINSTANCE hPreInstance, LPSTR lpCmdLine, int nCmdShow) {
MyRegisterClass (hInstance);
if (! InitInstance (hInstance, nCmdShow)) return 0;
MSG MSG.
While (GetMessage (& amp; MSG, NULL, 0, 0)) {
TranslateMessage (& amp; MSG);
DispatchMessage (& amp; MSG);
}
Return MSG. WParam;
}
In order to make the program would stop, I added a messagebox