Sign in to follow this  

Render a control to a texture

This topic is 3313 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

This topic is 3313 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this