views:

29

answers:

1

This puzzles me for years, since MFC. We all know DC limitations in Windows, and I really want to break free from it this time.

What I need is to be able to draw at some hWnd, i.e. control, at any time - from any thread, even using direct bit manipulation! Is there anybody that can shed some light to it.

I prefer that question should stay WPF-free. I like GDI, and I would like to stay in its embrace.

+2  A: 

draw at some hWnd, i.e. control, at any time - from any thread

This isn't going to happen in Windows. The basic windows controls are designed with thread affinity. You must use the thread which created the control to draw into the control (even with WPF). GDI (and GDI+) is based on these technologies, and will always require using a single rendering thread.

That being said, you can still do real time graphics. Just handle all of the processing on graphics threads, and only marshal the drawing onto the UI thread. This will be fast enough to draw nearly everything required.

If absolute rendering speed is required, you may want to switch to Direct2D or Direct3D for rendering. There are options for multithreaded rendering in Direct3D, though internally they still use locking.

However, you should be able to render at much greater than your monitor's refresh rate using D3D.

Reed Copsey