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
Using the following code you can get the icon for the running process, then call WM_SETICON to apply it to any window.
This prevents storing duplicate copies of the icon just to also reuse it for the window icon.
letOk(path) = std::env::current_exe()else{
return 0;};letOk(path) = U16CString::from_os_str(path.as_os_str())else{
return 0;};// SAFETY:// Path is checked to be a valid u16cstring above. The result is checked for errors where// 1 = not an icon or exe.// 0 = any other error.// While this obviously leaks the icon, the icon won't change for the lifetime of the program and can be used in more// than one window during the lifetime of the program.let icon = unsafe{ExtractIconW(GetModuleHandleW(std::ptr::null()), path.as_ptr(),0)};if icon asusize <= 1{return0;}
Relevant platforms
Windows
The text was updated successfully, but these errors were encountered:
Description
Using the following code you can get the icon for the running process, then call WM_SETICON to apply it to any window.
This prevents storing duplicate copies of the icon just to also reuse it for the window icon.
Relevant platforms
Windows
The text was updated successfully, but these errors were encountered: