Paint event in IE, generating 4 calls of OnDraw on windowless activex
Hi,
I have created a windowless activex(using ATL & Visual Studio 2008) and using IE as a container.
I am calling InvalidateRect(), to generate paint message and to invoke OnDraw method in Activex.
Here, OnDraw is getting called 4 times and each time the boundaries are different.
So, why the container invoking OnDraw() 4 times for each invalidateRect()(basically for paint event) call?Please let me know.
Thanks,
Prasad.
Durga
All Replies
- Why is it a problem?
Thanks for the reply.
Here, what i want to display is the video frames.
What i am doing is:
1. After receiving the decoded frame, i am calling ::InvalidateRect(m_hWndIE, &m_rcPos, FALSE). So, it calls the OnDraw() on the activex.(i think i cannot use ::FireViewChange(), because i am doing this in another thread).
2. In OnDraw() i am displaying the decoded frame.
Here i am getting the performance issue.
In windowed mode its taking 44 milli seconds to display a single frame. But in the windowless mode its taking 96 (24*4) milli seconds.(Per OnDraw() it's taking 24 milli seconds.).
And i observed the jerkyness in the video. I didn't understand this, Is it because of more timetaking or drawing block by block??
(In OnDraw i am getting the boundaries as
left - right - top - bottom
1. 0 - 835 - 0 - 470 (1st OnDraw() call)2. 0 - 835 - (-150) - 320 (2nd OnDraw() call)
3. 0 - 835 - (-300) - 170 (3rd OnDraw() call)
4. 0 - 835 - (-450) - 20 (4th OnDraw() call)
I badly needed windowless activex, because i want to display some text on the top of the video.(i can do this buy using z-index in javascript).
So, is there any wrong in my undsterstanding or way or approach? Or is there any other way to proceed?
Please let me know.
Thanks.
Durga- I am seeing the same thing. I'm hosting Direct2D content in an ActiveX control (was using IE as a stepping stone - will be creating a Gadget next). It seems that the larger the height of the control, the more times OnDraw will be called (in -150 increments until the negative of the height is reached).
I'm using Windows 7 and IE 8. - I suspect there is some IOleXXXXX interface method you need to implement and respond to correctly. One of the methods relating to clip rects or aspects or something. I have no idea what it might be though.
- Actually i didn't find any interface which is related to this.
Is it the correct approch, what i am doing here??I mean, to invoke the Paint message on the container, i am using InvalidateRect(). Because, continuous Paint calls make the processor busy, right??(If i try to display 30 Fps, its taking almost 95% CPU).
Durga I have talked to microsoft developer support team couple of days back. They were telling that we cann't do anything regarding this, because of IE behavior. They are suggesting to use windowed only.
Durga- Edited byDPrasad Friday, November 20, 2009 7:33 PMspelling mistake


