title: Fast (HW-accelerated) drawing to foreign window (probably using Direct3D)
body: <p>I am working on certain project where the task is to paint bitmaps (currently HBITMAP/bitblt/alphablend) into non-client areas of all visible windows (i.e. windows which do not belong to my application). It must be done very fast - bitmap is update when window is moved, resized etc. Also some kind of blur algorithm must be applied on this bitmap. It should work on Win7 and Win8 (so XP is not required).</p>
  
  <p>I have managed to work properly with GDI. I obtain GetWindowDC, GetWindowRect and AlphaBlend bitmap into buffer (CreateCompatibleDC/CreateCompatibleBitmap) and then BitBlt it into GetWindowDC. This works perfectly... except... it is not as fast as I want. And if I apply blur algorithm on the bitmap, then everything is slow as hell.</p>
  
  <p>So my question would be how to improve the speed? I'm thinking about hardware accelerated drawing.</p>
  
  <p>a) I tried GDI-compatible Direct2D (using ID2D1DCRenderTarget+BindDC) but it is much slower than pure GDI.</p>
  
  <p>b) I am thinking about Direct3D. Problem is that I probably don't know how to use it. If I call D3D10CreateDeviceAndSwapChain with swapchain's OutputWindow set to HWND of my application then it returns S_OK but when I set OutputWindow to HWND of any foreign window then the method fails. So I am not sure how to render into foreign windows.</p>
  
  <p>c) how to properly apply blur on a part of image? I found many algorithms but all of them are processed on CPU. How to make it on GPU?</p>
  
  <p>Thanks in advance for any idea how to solve my problem.</p>