Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GDI+ BitBlt Vista Aero Problem

57 views
Skip to first unread message

news-server.hawaii.rr.com

unread,
Oct 25, 2007, 7:21:08 AM10/25/07
to
Hi Folks,
I use the piece of code at the end of this post to monitor another apps
GUI to do some simple automation. It works fine under XP/2000, however when
testing on Vista-64 it was failing. I did finally figure out that if I
disable the Aero theme, it starts working again. First, is there a simple
work around to make this work with Aero? Also, I would not mind any tips if
there is generally a better approach than using BitBlt. Incendentally the
application I am trying to BitBlt from uses DirectX9 in a window.

Thanks,
BB

Bitmap* WindowBlt(Rect& rect)
{
// create a bitmap from the visible clipping bounds of the graphics
object from the window
Bitmap* bitmap = new Bitmap(rect.Width, rect.Height);

// create a graphics object from the bitmap
Graphics *gfxBitmap = Graphics::FromImage(bitmap);

// get a device context for the bitmap
HDC hdcBitmap = gfxBitmap->GetHDC();

// get a device context for the window
HDC hdcWindow = GetWindowDC(EQWndw);

// bitblt the window to the bitmap
BitBlt(hdcBitmap, 0, 0, rect.Width, rect.Height, hdcWindow, rect.X,
rect.Y, SRCCOPY);

// release the bitmap's device context
gfxBitmap->ReleaseHDC(hdcBitmap);

ReleaseDC(EQWndw, hdcWindow);

// dispose of the bitmap's graphics object
delete gfxBitmap;

// return the bitmap of the window
return bitmap;
}


0 new messages