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 x, y; int a = 3;
- SelectObject(dc, GetStockObject(DC_BRUSH));
- SetDCBrushColor(dc, RGB(0, 0, 255));
- MoveToEx(dc, 20, 280, NULL);
- LineTo(dc, 760, 280);
- MoveToEx(dc, 400, 20, NULL);
- LineTo(dc, 400, 540);
- SetDCBrushColor(dc, RGB(255, 0, 0));
- for (double t = 0; t < 2 * 3.14; t += 0.001) {
- x = cos(t);
- x = a * x * x * x;
- y = sin(t);
- y = a * y * y * y;
- SetPixel(dc, x * 70 + 400, 280 - y * 70, 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;
- 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