Skip to content

Commit 1939cce

Browse files
Merge pull request #12658 from Epica3055/BackPortPR12564And12648To8.0
[release/8.0] Fix WM_DESTROY message handling in ActiveX control
2 parents 675a58c + 75defd5 commit 1939cce

File tree

1 file changed

+4
-3
lines changed
  • src/System.Windows.Forms/src/System/Windows/Forms

1 file changed

+4
-3
lines changed

src/System.Windows.Forms/src/System/Windows/Forms/AxHost.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3370,13 +3370,14 @@ protected override unsafe void WndProc(ref Message m)
33703370

33713371
private unsafe void DetachAndForward(ref Message m)
33723372
{
3373+
HWND handle = GetHandleNoCreate();
33733374
DetachWindow();
3374-
if (IsHandleCreated)
3375+
if (!handle.IsNull)
33753376
{
3376-
void* wndProc = (void*)PInvoke.GetWindowLong(this, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
3377+
void* wndProc = (void*)PInvoke.GetWindowLong(handle, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
33773378
m.ResultInternal = PInvoke.CallWindowProc(
33783379
(delegate* unmanaged[Stdcall]<HWND, uint, WPARAM, LPARAM, LRESULT>)wndProc,
3379-
HWND,
3380+
handle,
33803381
(uint)m.Msg,
33813382
m.WParamInternal,
33823383
m.LParamInternal);

0 commit comments

Comments
 (0)