Загрузка...

Crosshair

Тема в разделе C/C++ создана пользователем Alia111 1 дек 2018. 185 просмотров

Загрузка...
  1. Alia111
    Alia111 Автор темы 1 дек 2018 Top coder сия Русси 1 29 мар 2018
    Эта хрень рисует крестик по центру по верх всех окон ( кроме полноэкранного режима )

    На f9 закрывается

    Код

    #include <Windows.h>

    int x = 0;
    int y = 1;

    int main()
    {
    SetConsoleTitleA("???");

    HDC dc = GetWindowDC(GetDesktopWindow());

    x = GetSystemMetrics(x) / 2; // SM_CXSCREEN
    y = GetSystemMetrics(y) / 2; // SM_CYSCREEN

    for (;;)
    {
    for (int r = 255; ; )
    {
    for (int g = 0; ; )
    {
    for (int b = 0; ; )
    {
    SetPixel(dc, x, y, RGB(r, g, b));

    SetPixel(dc, x + 1, y, RGB(r, g, b));
    SetPixel(dc, x + 2, y, RGB(r, g, b));
    SetPixel(dc, x + 3, y, RGB(r, g, b));
    SetPixel(dc, x + 4, y, RGB(r, g, b));
    SetPixel(dc, x + 5, y, RGB(r, g, b));
    SetPixel(dc, x + 6, y, RGB(r, g, b));
    SetPixel(dc, x - 1, y, RGB(r, g, b));
    SetPixel(dc, x - 2, y, RGB(r, g, b));
    SetPixel(dc, x - 3, y, RGB(r, g, b));
    SetPixel(dc, x - 4, y, RGB(r, g, b));
    SetPixel(dc, x - 5, y, RGB(r, g, b));
    SetPixel(dc, x - 6, y, RGB(r, g, b));

    SetPixel(dc, x, y + 1, RGB(r, g, b));
    SetPixel(dc, x, y + 2, RGB(r, g, b));
    SetPixel(dc, x, y + 3, RGB(r, g, b));
    SetPixel(dc, x, y + 4, RGB(r, g, b));
    SetPixel(dc, x, y + 5, RGB(r, g, b));
    SetPixel(dc, x, y + 6, RGB(r, g, b));
    SetPixel(dc, x, y - 1, RGB(r, g, b));
    SetPixel(dc, x, y - 2, RGB(r, g, b));
    SetPixel(dc, x, y - 3, RGB(r, g, b));
    SetPixel(dc, x, y - 4, RGB(r, g, b));
    SetPixel(dc, x, y - 5, RGB(r, g, b));
    SetPixel(dc, x, y - 6, RGB(r, g, b));

    /*SetPixel(dc, x + 1, y + 1, RGB(r, g, b));
    SetPixel(dc, x + 2, y + 1, RGB(r, g, b));
    SetPixel(dc, x + 3, y + 1, RGB(r, g, b));
    SetPixel(dc, x + 4, y + 1, RGB(r, g, b));
    SetPixel(dc, x + 5, y + 1, RGB(r, g, b));
    SetPixel(dc, x + 6, y + 1, RGB(r, g, b));
    SetPixel(dc, x - 1, y + 1, RGB(r, g, b));
    SetPixel(dc, x - 2, y + 1, RGB(r, g, b));
    SetPixel(dc, x - 3, y + 1, RGB(r, g, b));
    SetPixel(dc, x - 4, y + 1, RGB(r, g, b));
    SetPixel(dc, x - 5, y + 1, RGB(r, g, b));
    SetPixel(dc, x - 6, y + 1, RGB(r, g, b));*/

    SetPixel(dc, x + 1, y - 1, RGB(r, g, b));
    SetPixel(dc, x + 2, y - 1, RGB(r, g, b));
    SetPixel(dc, x + 3, y - 1, RGB(r, g, b));
    SetPixel(dc, x + 4, y - 1, RGB(r, g, b));
    SetPixel(dc, x + 5, y - 1, RGB(r, g, b));
    SetPixel(dc, x + 6, y - 1, RGB(r, g, b));
    SetPixel(dc, x - 1, y - 1, RGB(r, g, b));
    SetPixel(dc, x - 2, y - 1, RGB(r, g, b));
    SetPixel(dc, x - 3, y - 1, RGB(r, g, b));
    SetPixel(dc, x - 4, y - 1, RGB(r, g, b));
    SetPixel(dc, x - 5, y - 1, RGB(r, g, b));
    SetPixel(dc, x - 6, y - 1, RGB(r, g, b));

    SetPixel(dc, x + 1, y + 1, RGB(r, g, b));
    SetPixel(dc, x + 1, y + 2, RGB(r, g, b));
    SetPixel(dc, x + 1, y + 3, RGB(r, g, b));
    SetPixel(dc, x + 1, y + 4, RGB(r, g, b));
    SetPixel(dc, x + 1, y + 5, RGB(r, g, b));
    SetPixel(dc, x + 1, y + 6, RGB(r, g, b));
    SetPixel(dc, x + 1, y - 1, RGB(r, g, b));
    SetPixel(dc, x + 1, y - 2, RGB(r, g, b));
    SetPixel(dc, x + 1, y - 3, RGB(r, g, b));
    SetPixel(dc, x + 1, y - 4, RGB(r, g, b));
    SetPixel(dc, x + 1, y - 5, RGB(r, g, b));
    SetPixel(dc, x + 1, y - 6, RGB(r, g, b));

    /*SetPixel(dc, x - 1, y + 1, RGB(r, g, b));
    SetPixel(dc, x - 1, y + 2, RGB(r, g, b));
    SetPixel(dc, x - 1, y + 3, RGB(r, g, b));
    SetPixel(dc, x - 1, y + 4, RGB(r, g, b));
    SetPixel(dc, x - 1, y + 5, RGB(r, g, b));
    SetPixel(dc, x - 1, y + 6, RGB(r, g, b));
    SetPixel(dc, x - 1, y - 1, RGB(r, g, b));
    SetPixel(dc, x - 1, y - 2, RGB(r, g, b));
    SetPixel(dc, x - 1, y - 3, RGB(r, g, b));
    SetPixel(dc, x - 1, y - 4, RGB(r, g, b));
    SetPixel(dc, x - 1, y - 5, RGB(r, g, b));
    SetPixel(dc, x - 1, y - 6, RGB(r, g, b));*/

    if (GetAsyncKeyState(VK_F9))
    return 0;
    }
    }
    }
    }
    }
     
Top