Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define _WIN32_WINNT 0X0A00
- #include <windows.h>
- void WinShow(HDC dc)
- {
- SelectObject(dc, GetStockObject(DC_BRUSH));
- SetDCBrushColor(dc, RGB(200, 100, 255));
- SelectObject(dc, GetStockObject(DC_PEN));
- SetDCPenColor(dc, RGB(255, 0, 0));
- Rectangle(dc, 100, 100, 150, 300);
- SetDCPenColor(dc, RGB(50, 50, 50));
- SetDCBrushColor(dc, RGB(255, 250, 0));
- Ellipse(dc, 125, 100, 200, 180);
- SetDCBrushColor(dc, RGB(170, 255, 100));
- Ellipse(dc, 225, 100, 300, 300);
- }
- LRESULT WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
- {
- if (message == WM_DESTROY)
- PostQuitMessage(0);
- else return DefWindowProcA(hwnd, message, wparam, lparam);
- }
- int main()
- {
- WNDCLASSA wcl;
- memset(&wcl, 0, sizeof(WNDCLASSA));
- wcl.lpszClassName = "my_Window";
- wcl.lpfnWndProc = WndProc;
- RegisterClassA(&wcl);
- HWND hwnd = CreateWindow(L"my_Window", L"Окошечко", WS_OVERLAPPEDWINDOW, 10, 10, 800, 600, NULL, NULL, NULL, NULL);
- HDC dc = GetDC(hwnd);
- ShowWindow(hwnd, SW_SHOWNORMAL);
- MSG msg;
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- WinShow(dc);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement