[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

How to handle OnDraw(ATL_DRAWINFO& di) in ATL windowless activex?

Asked by dhar1508 in Microsoft Visual C++, ActiveX, Web Development

Tags: ATL Windowless activex, OnDraw()

Hi,
I have created a windowless activex(using ATL & Visual Studio 2008, not using MFC) and using IE as a container. 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 generates WM_PAINT message to the container window and 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 by using DIB function calls.

While using IE as the container, OnDraw() is getting called 4 times(4 times is not the constant, it varies depending on the height of the activex rectangle) for each call of InvalidateRect() or FireViewChange(). Because of this i am getting some performance issue.(If i use MFC dialog as a container OnDraw() is getting called only once for each call of InvalidateRect()).

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  do i need to proceed differently?

If the IE sends the boundaries as blocks, for optimization, then is there any setting or option to turn it off?
Please let me know.

Thanks in advance.
[+][-]11/18/09 09:13 PM, ID: 25857701Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/20/09 11:27 AM, ID: 25873589Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/24/09 09:48 PM, ID: 25904524Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625