You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.
I wanted to use set_icon_from_buffer, with an embeded icon from the incude_bytes! macro, but i kept getting the Error "Cannot load icon from the buffer: 0". The icon worked fine with set_icon_from_file, so that wasnt the issue.
let icon_data = &buffer[offset as usize..];
let hicon = unsafe {
winuser::CreateIconFromResourceEx(
icon_data.as_ptr() as PBYTE,
0,
TRUE,
0x30000,
width as i32,
height as i32,
LR_DEFAULTCOLOR,
)
};
to this:
let icon_data = &buffer[offset as usize..];
let hicon = unsafe {
winuser::CreateIconFromResourceEx(
icon_data.as_ptr() as PBYTE,
icon_data.len() as u32,
TRUE,
0x30000,
width as i32,
height as i32,
LR_DEFAULTCOLOR,
)
};
It worked like a charm! I don't know if anyone else have this issue, but in my case I had to do it.
The text was updated successfully, but these errors were encountered:
I wanted to use
set_icon_from_buffer
, with an embeded icon from theincude_bytes!
macro, but i kept getting the Error "Cannot load icon from the buffer: 0". The icon worked fine withset_icon_from_file
, so that wasnt the issue.After looking at the code I looked up some of the documentaion on the Windows API and discovered a mistake with the use of
CreateIconFromResourceEx
(https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createiconfromresourceex). The second argument should be the length of the first arguments i bytes, but in the module it was set to 0.After chaning this (/src/api/win32/mod.rs):
to this:
It worked like a charm! I don't know if anyone else have this issue, but in my case I had to do it.
The text was updated successfully, but these errors were encountered: