修改windows系统鼠标样式

#include <windows.h>
#include "WinUser.h"
#pragma comment(lib, "User32.lib")
    //设置自定义鼠标样式
    QString dirPath = QCoreApplication::applicationDirPath() + "/";
    QString fullDirPath = dirPath + "Picker32.ico";
    LOG(INFO) <<"cursor fullDirPath "<<fullDirPath.toStdString();

    QByteArray ba = fullDirPath.toLatin1();
    char* szStr = ba.data();
    LOG(INFO) <<std::string(szStr);

    WCHAR wszClassName[256];
    memset(wszClassName,0,sizeof(wszClassName));
    MultiByteToWideChar(CP_ACP,0,szStr,strlen(szStr)+1,wszClassName,
                        sizeof(wszClassName)/sizeof(wszClassName[0]));
    HCURSOR hcur = (HCURSOR)LoadImage(NULL,wszClassName,IMAGE_ICON,32,32,LR_LOADFROMFILE);
    ::SetSystemCursor(hcur, 32512);
    ::SystemParametersInfo(SPI_SETCURSORS,0,NULL,SPIF_SENDCHANGE); //设置鼠标为默认样式
    HCURSOR hcur = LoadCursorW(NULL, IDC_ARROW);//系统样式
    ::SetSystemCursor(hcur, 32512);
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值