• Advertisement
Sign in to follow this  

DirectDraw overlay and Vista Aero glass

This topic is 4275 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi All, I am new to this forum and I came upon this article, http://www.gamedev.net/community/forums/topic.asp?topic_id=359319, on google while doing a search on DirectDraw overlay on Vista OS. I was wondering why this sample code in the above article does not work on Vista with the Aeroglass feature is enabled. If I disable the Aeroglass feature, the code works. Hope someone can help. Thanks, Geoff

Share this post


Link to post
Share on other sites
Advertisement
I can't even take a normal screenshot with Aero enabled. Though I did get an email a few days ago saying that bug was fixed in RC1. So perhaps overlays will work better for you in that release.

Share this post


Link to post
Share on other sites
Thanks. I will give RC1 a try.

Here is code snippet that worked for me for capturing Vista desktop with aero enabled. I am using vista build 5384. I found the sample on-line. Nothing special. Have not tried with RC1. Hopefully nothing is broken.


//Create a ScreenDC to capture the screen bits.
CDC ScrDC;
HWND hDesktopWnd = GetDesktopWindow();
HDC hDesktopDC = GetDC(hDesktopWnd);
ScrDC.Attach(hDesktopDC);

//Get the DIB Bits
int DIBWidth = ScrDC.GetDeviceCaps(HORZRES);
int DIBHeight = ScrDC.GetDeviceCaps(VERTRES);

//Create a Compatible Bitmap
HBITMAP hCompatibleBitmap = GetDeviceBitmapHandle(ScrDC.m_hDC,&DIBWidth,&DIBHeight);

if(hCompatibleBitmap == NULL)
{
ScrDC.DeleteDC();
return false;
}



DWORD *DIBits = new DWORD[DIBWidth * DIBHeight];
BITMAPINFO bi = *(NewBitmap->GetInfo());
bi.bmiHeader.biWidth = DIBWidth;
bi.bmiHeader.biHeight = DIBHeight;
bi.bmiHeader.biSizeImage = DIBWidth * DIBHeight * (bi.bmiHeader.biBitCount / 8);

if(::GetDIBits(ScrDC.m_hDC,hCompatibleBitmap,0,DIBHeight,(void *)DIBits,&bi,DIB_RGB_COLORS) == 0)
{
ScrDC.DeleteDC();
delete [] DIBits;
return false;
}

Share this post


Link to post
Share on other sites
Keep in mind that DirectDraw is no longer supported, and that Microsoft recommends using Direct3D instead, even for pure 2D graphics.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement