[Windows] Avoid GetModuleHandle(NULL) (#2301)
Use get_instance_handle() over GetModuleHandle(NULL)
This commit is contained in:
parent
f11270dac0
commit
5d85c10a2c
4 changed files with 27 additions and 14 deletions
|
|
@ -1,10 +1,9 @@
|
|||
use std::{fmt, io, mem, path::Path, ptr, sync::Arc};
|
||||
use std::{fmt, io, mem, path::Path, sync::Arc};
|
||||
|
||||
use windows_sys::{
|
||||
core::PCWSTR,
|
||||
Win32::{
|
||||
Foundation::HWND,
|
||||
System::LibraryLoader::GetModuleHandleW,
|
||||
UI::WindowsAndMessaging::{
|
||||
CreateIcon, DestroyIcon, LoadImageW, SendMessageW, HICON, ICON_BIG, ICON_SMALL,
|
||||
IMAGE_ICON, LR_DEFAULTSIZE, LR_LOADFROMFILE, WM_SETICON,
|
||||
|
|
@ -111,7 +110,7 @@ impl WinIcon {
|
|||
let (width, height) = size.map(Into::into).unwrap_or((0, 0));
|
||||
let handle = unsafe {
|
||||
LoadImageW(
|
||||
GetModuleHandleW(ptr::null()),
|
||||
util::get_instance_handle(),
|
||||
resource_id as PCWSTR,
|
||||
IMAGE_ICON,
|
||||
width as i32,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue