Jump to content
  • Advertisement
Sign in to follow this  
akaitora

Render a control to a texture

This topic is 3561 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. I am trying to render a flash to a d3d texture. This is more of a winapi question than a directx question. I am currently trying to use bitblt to copy the device context of my flash control onto an hbitmap. After that, I will use the D3DxCreateTextureFromMemory to render my hbitmap. The following is how I am doing it.
HBITMAP FlashController::getTexture(HWND hWnd)
{
	flashPlayer->Show();
	HDC flashDC = GetDC((HWND)flashPlayer->Handle.ToPointer());
	
	HDC destDC = CreateCompatibleDC(flashDC);
	HBITMAP hBMP = CreateCompatibleBitmap(destDC,
										  800, 
										  600);

	SelectObject(destDC, hBMP);
	if(BitBlt(destDC,0,0,800,600,
		   flashDC,0,0, 
		   SRCCOPY) == 0)
	{
		return NULL;
	}

	BITMAP bmp;
	GetObject(hBMP,sizeof(BITMAP),&bmp);
		
	return hBMP;

}
However when I check the bmp's bmBits is pointing to 0 which tells me my image didn't get loaded correctly. Does anyone see why my code wouldn't work here? Thanks!

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!