gpt4 book ai didi

Read icon with different sizes from exe and put it to glfwSetWindowIcon(从exe中读取不同大小的图标,并将其放入glfwSetWindowIcon)

转载 作者:bug小助手 更新时间:2023-10-25 18:27:27 38 4
gpt4 key购买 nike



I saw a lot of questions related to this problem but I couldn't find a solution at the moment.

我看到了很多与这个问题有关的问题,但我目前找不到解决方案。


I have added an icon with different sizes to my executable using Visual Studio, and I want now to define the icon of the application by reading the app, in order to avoid to give the png with the exe.

我已经添加了一个不同大小的图标到我的可执行文件使用Visual Studio,我现在想通过阅读应用程序来定义应用程序的图标,以避免给PNG与可执行文件。


Here is the beginning of my code:

下面是我的代码的开头:


// Defining the icon for the application
const size_t iconsNumber = 7;
GLFWimage icons[iconsNumber];

const std::vector<size_t> iconsSizes = {16, 20, 24, 32, 48, 64, 256};

// The icons are read from the exe ico
HICON iconsHolder[iconsNumber] = { NULL };
ICONINFO iconInfo[iconsNumber];

HINSTANCE hInstance = GetModuleHandle(NULL); // Points to the current executable
LPCWSTR iconAddress = MAKEINTRESOURCE(IDI_ICON1); // Points to the icon .exe resource
for (size_t i = 0; i < iconsNumber; i++) {

iconsHolder[i] = static_cast<HICON>(LoadImage(hInstance, iconAddress, IMAGE_ICON,
iconsSizes[i], iconsSizes[i], LR_DEFAULTCOLOR));

GetIconInfo(iconsHolder[i], &iconInfo[i]);
// From what I understood, the values of the pixels of each icon
// are stored and may be accessed from iconInfo[i].hbmColor

icons[i].height = iconsSizes[i];
icons[i].width = iconsSizes[i];

// We should now read the values of the pixels that are inside the HICON
//icons[i].pixels = pixels;
}

//glfwSetWindowIcon(window, iconsNumber, icons);

I know that my iconsHolder is never equal to NULL, but now everything that I tried failed. I don't know what to do now to move the data from iconInfo[i].hbmColor to pixels.

我知道我的iconsHolder从来不等于空,但现在我尝试的所有东西都失败了。我不知道现在该怎么做才能将数据从iconInfo[i].hbmColor移动到像素。


更多回答
优秀答案推荐
更多回答

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com