Skip to content

Commit d592148

Browse files
Merge pull request #12659 from Epica3055/BackPortPR12564And12648To9.0
[release/9.0] Fix WM_DESTROY message handling in ActiveX control
2 parents 2506929 + 66bc6ed commit d592148

File tree

1 file changed

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

1 file changed

+4
-3
lines changed

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

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

32353235
private unsafe void DetachAndForward(ref Message m)
32363236
{
3237+
HWND handle = GetHandleNoCreate();
32373238
DetachWindow();
3238-
if (IsHandleCreated)
3239+
if (!handle.IsNull)
32393240
{
3240-
void* wndProc = (void*)PInvoke.GetWindowLong(this, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
3241+
void* wndProc = (void*)PInvoke.GetWindowLong(handle, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
32413242
m.ResultInternal = PInvoke.CallWindowProc(
32423243
(delegate* unmanaged[Stdcall]<HWND, uint, WPARAM, LPARAM, LRESULT>)wndProc,
3243-
HWND,
3244+
handle,
32443245
(uint)m.Msg,
32453246
m.WParamInternal,
32463247
m.LParamInternal);

0 commit comments

Comments
 (0)