CodePudding user response:
Win32 native API calls the Windows system or QT this tripartite interface libraryCodePudding user response:
"Visual c + + classic case of game development,"CodePudding user response:
Minimum Windows API graphics programming example:# pragma comment (lib, "user32")
# pragma comment (lib, "gdi32")
#include
LRESULT a CALLBACK WndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM) {
PAINTSTRUCT ps;
HDC HDC.
HFONT HFONT ohfont;
The RECT r;
COLORREF oc;
The switch (the message) {
Case WM_CLOSE://Alt + F4 exit
The PostQuitMessage (0);
break;
In case the WM_PAINT:
BeginPaint (hWnd, & amp; Ps);
HDC=ps. HDC;//the device context to the draw in
GetClientRect (hWnd, & amp; R);//Obtain the window 's client rectangle
Hfont=CreateFont (200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "tahoma");
Ohfont=(HFONT) SelectObject (HDC, HFONT);
Oc=SetTextColor (HDC, 0 x00c080ff);
SetBkMode (HDC, TRANSPARENT);
TextOut (HDC, r.l eft + r.r d.light/2-600, r.t op + r. b ottom/2-100, "the shortest drawing program", 12);
SelectObject (HDC, ohfont);
SetTextColor (HDC, oc);
DeleteObject (hfont);
EndPaint (hWnd, & amp; Ps);
break;
Default:
Return DefWindowProc (hWnd, message, wParam, lParam);
}
return 0;
}
Int WINAPI WinMain (HINSTANCE HINSTANCE, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
MSG MSG={0};
WNDCLASS wc={0};
HBRUSH HBRH;
HBRH=CreateSolidBrush (0 x00000000);
Wc. LpfnWndProc=WndProc;
The wc. The hInstance=hInstance;
Wc. HbrBackground=HBRH;
Wc. LpszClassName="minwindowsapp";
Wc. HCursor=LoadCursor (NULL, IDC_ARROW);
If (0==RegisterClass (& amp; Wc)) return 1;
If (NULL==CreateWindow (wc) lpszClassName,
"Minimal Windows Application,"
WS_POPUP | WS_VISIBLE,
0,
0,
GetSystemMetrics (SM_CXSCREEN),
GetSystemMetrics (SM_CYSCREEN),
0,
0,
HInstance,
NULL))
return 2;
While (GetMessage (& amp; MSG, NULL, 0, 0) & gt; 0 {
DispatchMessage (& amp; MSG);
}
DeleteObject (HBRH);
return 0;
}
CodePudding user response: