有没有一种方法可以加载游标而不重新启动或注销?

时间:2019-11-28 13:42:27

标签: c++ windows

我想加载游标而不重启计算机注销。

我尝试使用LoadCursorFromFile函数,但是不起作用。

还有其他方法可以加载游标吗?

编辑:我也尝试过使用SetCursor函数,但是它仍然无法正常工作。

这是我当前的代码:

#include <iostream>
#include <Windows.h>
#include <lmcons.h>
#pragma comment(lib, "urlmon.lib")  

using namespace std;

string username()
{
    char username[UNLEN + 1];
    DWORD username_len = UNLEN + 1;
    GetUserName(username, &username_len);
    return username;
}

int main()
{
    string dir = "C:\\Users\\" + username() + "\\Documents\\Dragonite";
    string dwnld_URL = "https://srv-file7.gofile.io/download/2rNCim/nat927.ani";
    string savepath = "C:\\Users\\" + username() + "\\Documents\\Dragonite\\nyan.ani";

    CreateDirectory(dir.c_str(), NULL);

    URLDownloadToFile(NULL, dwnld_URL.c_str(), savepath.c_str(), 0, NULL);

    Sleep(5000);

    HCURSOR hCur = LoadCursorFromFile(savepath.c_str());
    SetCursor(hCur);
    return 0;
}

谢谢!

1 个答案:

答案 0 :(得分:1)

我已经完成了项目,现在可以正常工作了,特别感谢@enhzflep

我已将return ( <RenderOverview work={selectedOption ? work.filter(value => value.pure_taxonomies.types[0].name === selectedOption.label) : work} /> ); 的功能更改为SetCursor

*注意-要使应用程序使用任何OCR_常量,必须先进入SetSystemCursor,然后再包含#define OEMRESOURCE库!

Windows.h