why ATL based ACTIVEX control got flicker when Redraw
-
Hi,All,I am developing an ACTIVEX control embedded in IE, which is used to display continuous jpegs captured from a server.Firstly I wrote my ACTIVEX control in MFC,and call InvalidateControl() to realize control window redraw.It is ok.Then I rewrote my ACTIVEX in ATL,most of the code regards to grapic are same,but this time since InvalidateControl() can not be called in ATL based control, I call FireViewChange() to realize control window redraw time by time.However,I found that the control window got flicker when it is redraw.What happened and how to deal with? please contact: max_xiayi@hotmail.com
-
Hi,All,I am developing an ACTIVEX control embedded in IE, which is used to display continuous jpegs captured from a server.Firstly I wrote my ACTIVEX control in MFC,and call InvalidateControl() to realize control window redraw.It is ok.Then I rewrote my ACTIVEX in ATL,most of the code regards to grapic are same,but this time since InvalidateControl() can not be called in ATL based control, I call FireViewChange() to realize control window redraw time by time.However,I found that the control window got flicker when it is redraw.What happened and how to deal with? please contact: max_xiayi@hotmail.com
FireViewChange() calls InvalidateRect with bErase=TRUE. You'll need to write your own FireViewChange() and pass FALSE for bErase.
inline HRESULT CComControlBase::FireViewChange() { if (m_bInPlaceActive) { // Active if (m_hWndCD != NULL) ::InvalidateRect(m_hWndCD, NULL, TRUE); // Window based else if (m_spInPlaceSite != NULL) m_spInPlaceSite->InvalidateRect(NULL, TRUE); // Windowless } else // Inactive SendOnViewChange(DVASPECT_CONTENT); return S_OK; }
Todd Smith -
FireViewChange() calls InvalidateRect with bErase=TRUE. You'll need to write your own FireViewChange() and pass FALSE for bErase.
inline HRESULT CComControlBase::FireViewChange() { if (m_bInPlaceActive) { // Active if (m_hWndCD != NULL) ::InvalidateRect(m_hWndCD, NULL, TRUE); // Window based else if (m_spInPlaceSite != NULL) m_spInPlaceSite->InvalidateRect(NULL, TRUE); // Windowless } else // Inactive SendOnViewChange(DVASPECT_CONTENT); return S_OK; }
Todd SmithHaving the same problem here. I have tried the above suggestion but it has not worked. I still get flickering. I have also user temporary DC buffer to do all the drawing onto before copying the buffer to the final output in one step. Anybody come up with another way arround this? Thanks, Aristotel :^)
-
Having the same problem here. I have tried the above suggestion but it has not worked. I still get flickering. I have also user temporary DC buffer to do all the drawing onto before copying the buffer to the final output in one step. Anybody come up with another way arround this? Thanks, Aristotel :^)
Anyone? :^)
-
Anyone? :^)
Ok...quite embarrasing but basically I had forgotten to add MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) So onEraseBkgnd was not being called at all. Silly me... :~