[Windows] Avoid GetModuleHandle(NULL) (#2301)

Use get_instance_handle() over GetModuleHandle(NULL)
This commit is contained in:
Aron Parker 2022-05-29 17:12:46 +02:00 committed by GitHub
parent f11270dac0
commit 5d85c10a2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 14 deletions

View file

@ -26,7 +26,6 @@ use windows_sys::Win32::{
Com::{
CoCreateInstance, CoInitializeEx, CoUninitialize, CLSCTX_ALL, COINIT_APARTMENTTHREADED,
},
LibraryLoader::GetModuleHandleW,
Ole::{OleInitialize, RegisterDragDrop},
},
UI::{
@ -974,7 +973,7 @@ where
CW_USEDEFAULT,
parent.unwrap_or(0),
pl_attribs.menu.unwrap_or(0),
GetModuleHandleW(ptr::null()),
util::get_instance_handle(),
&mut initdata as *mut _ as *mut _,
);
@ -1013,7 +1012,7 @@ unsafe fn register_window_class<T: 'static>(
lpfnWndProc: Some(super::event_loop::public_window_callback::<T>),
cbClsExtra: 0,
cbWndExtra: 0,
hInstance: GetModuleHandleW(ptr::null()),
hInstance: util::get_instance_handle(),
hIcon: h_icon,
hCursor: 0, // must be null in order for cursor state to work properly
hbrBackground: 0,