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>
- #include <corecrt_math.h>
- void WinShow(HDC dc)
- {
- double y;
- SelectObject(dc, GetStockObject(DC_BRUSH));
- SetDCBrushColor(dc, RGB(0, 0, 255));
- MoveToEx(dc, 20, 400, NULL);
- LineTo(dc, 760, 400);
- MoveToEx(dc, 100, 20, NULL);
- LineTo(dc, 100, 540);
- SetDCBrushColor(dc, RGB(255, 0, 0));
- for (double x = 0; x < 3.14; x += 0.005) {
- y = sin(x);
- SetPixel(dc, x * 200 + 100, 400 - y * 200, RGB(255, 0, 0));
- }
- }
- 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