Skip to content

Comments

Use proper hInstance when registering window class#88

Merged
MiKom merged 1 commit intomainfrom
set-proper-hinstance-on-windows-eventloop-window-class
Oct 17, 2025
Merged

Use proper hInstance when registering window class#88
MiKom merged 1 commit intomainfrom
set-proper-hinstance-on-windows-eventloop-window-class

Conversation

@MiKom
Copy link
Member

@MiKom MiKom commented Aug 13, 2025

We passed nullptr as hInstance and this could potentially be bad if two instances of KDUtils were linked to the application (e.g. plugins).

Unlikely but let's do it right. Current module is obtained through a trick where a function passes itself to GetModuleHandleEx to make sure we get the module handle of the current dll.

See: https://devblogs.microsoft.com/oldnewthing/20110715-00/?p=10133

@MiKom MiKom force-pushed the set-proper-hinstance-on-windows-eventloop-window-class branch from d3e3a3a to 8cb61dc Compare August 13, 2025 21:07
@MiKom MiKom requested review from mkrus and seanharmer August 13, 2025 21:07
@MiKom MiKom assigned MiKom and unassigned mkrus and seanharmer Aug 13, 2025
We passed nullptr as hInstance and this could potentially be bad
if two instances of KDUtils were linked to the application
(e.g. plugins).

Unlikely but let's do it right. Current module is obtained through
a trick where a function passes itself to GetModuleHandleEx to make
sure we get the module handle of the current dll.

See: https://devblogs.microsoft.com/oldnewthing/20110715-00/?p=10133
@MiKom MiKom force-pushed the set-proper-hinstance-on-windows-eventloop-window-class branch from 8cb61dc to 24e7e80 Compare October 17, 2025 10:00
@MiKom MiKom merged commit d90d689 into main Oct 17, 2025
34 checks passed
@MiKom MiKom deleted the set-proper-hinstance-on-windows-eventloop-window-class branch October 17, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants