dotnet / dotnet/winforms

NativeWindow AssignHandle/ReleaseHandle should use Set/RemoveWindowSubclass

Open
#2,380 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

`NativeWindow AssignHandle/ReleaseHandle` use `SetWindowLongPtr` to subclass windows. This is particularly problematic if multiple independent components subclass the same window, as described here:

https://blogs.msdn.microsoft.com/anandgeorge/2010/04/10/usage-of-nativewindow-assignhandlereleasehandle-when-unmanaged-code-is-involved/

Our Office add-in coexists with other .NET add-ins and frequently runs into this problem. To solve it, `NativeWindow` should use the `COMCTL32` `SetWindowSubclass`/`RemoveWindowSubclass` API.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.