DeferWindowPos weird behavior

This happens with all ActiveX controls. If I move an ActiveX control using DeferWindowPos

HDWP hdwp = BeginDeferWindowPos(1);
DeferWindowPos(hdwp, m_pActiveX->GetSafeHwnd(), NULL, left, top, width, height, SWP_NOZORDER);
EndDeferWindowPos(hdwp);

it goes there , but then moves / resizes to the old rectangle as soon as you click anywhere on the control . If I use MoveWindow instead

m_pActiveX->MoveWindow(left, top, width, height);

this does not happen.

This does not happen with any other type of control, only with ActiveX controls, but it happens with all of them. I did a test to confirm this by creating a new ActiveX management project and made no changes, and the problem was still there.

+5
source share
2 answers

. .

, MFC ActiveX . , MoveWindow, Win32 MoveWindow. OLE Control Container. , , COleControlSite:: MoveWindow, Win32 MoveWindow. , CWnd .. , COleControlSite:: SetWindowPos / , COleControlSite:: MoveWindow, , , , :: SetWindowPos ( move/show ), .

COleControlSite:: MoveWindow , : SetExtent, m_rect, SetObjectRects.

ActiveX API Win32 (, DeferWindowPos) . , , .

+6

ActiveX?

, , DeferWindowPos . , begin, , .

, SetWindowPos.

, , . , , , SWP_NOSENDCHANGING DeferWindowPos, WINDOWPOS, .

, ... ?

+1

All Articles