Problem with sharing the CFbsitmap.

For Simultaneous Rendering following are the tryouts.

1) While camera is rendering one RGB file we tried to render the other RGB video file simultaneously.

Solution: The reason is Two different threads cannot access the Graphics
context at a time. As a solution we created the split views i.e. two
different views, which has it's own graphic context, so that each thread can
use separate view. We created an interface class for view and video sink
(which is another dll in same process)and tried to pass the view's CWindowGC
and Window() to video sink through this interface class, but it used crash while
activating the CWindowGc. So we passed the CFbsBitmap pointer from video sink to view
through Interface class for rendering. In view with the help of CDirectScreenAccess API's
we rendered the video without any problem, Now we can render the two videos
simultaneously and even it handles the events and redraws the screen automatically.

2) Now we can render two video simultaneously but when we close the
application it panics.

Problem : As we are getting the CFbsBitmap pointer from video sink to View,
when we close the TVPhone application it's creating panic.

Tryouts for this problem.

a) Even though we are rendering in View, the context of rendering is with
respect to video sink, because callback comes from video sink and we get the
pointer to view and it renders there. When we close the application, Exit
command is first executed by video sink thread then it comes to view. But
some functionality of BitBlt function in view doesn't allow the CFbsBitmap
to be deleted and hence it's causing the Panic.

b) We created the two bitmap, one in view and other in video sink and tried
to copy the data from sink's bitmap to view's bitmap by sending the view's
bitmap pointer to sink through interface class, this once again resulted in

c) We tried to duplicate the bitmap, but it once agian resulted in panic, because view and
video sink has it's own RWssession and it won't allow the duplication of bitmap.