c++ - DeferWindowPos weird behaviour -
this happens activex controls. if reposition activex control deferwindowpos
hdwp hdwp = begindeferwindowpos(1); deferwindowpos(hdwp, m_pactivex->getsafehwnd(), null, left, top, width, height, swp_nozorder); enddeferwindowpos(hdwp); it goes there but moves/resizes old rectangle once click anywhere inside control. if use movewindow instead
m_pactivex->movewindow(left, top, width, height); this doesn't happen.
it doesn't happen other type of control, activex controls, happens of them. made test confirm this, creating new activex control project , didn't make changes, , problem still there.
you never got appropriate answer. i'll try out bit here.
the issue mfc hides lot of trickiness hosting activex control within it's framework. specifically, if step movewindow call, not wrapper around win32 movewindow function. calls ole control container support classes. says, if have control site interface, call colecontrolsite::movewindow, otherwise call standard win32 movewindow. same occurs several other window functions handled cwnd etc. example colecontrolsite::setwindowpos handles hiding/showing control, calls colecontrolsite::movewindow move it, , calls ::setwindowpos (with move/show flags masked out) handle rest.
once within colecontrolsite::movewindow, notice several things: calls setextent, updates it's internal m_rect member, , calls setobjectrects.
bypassing these activex controls using win32 api directly (eg via deferwindowpos) causes of these crucial steps missed. depending on how code layed out, can handle yourself.
Comments
Post a Comment