Sign in to follow this  

DIRECTX9 - HDC TO SURFACE

This topic is 1829 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 have two applications: The first application contains a Picturebox with a flower image and the second application is based on Directx 9 and contains a directx surface. Now I want to copy the picture box image data(flower) from the first application into the surface of the Directx application. But all I get is a black screen.

 

 

LPDIRECT3DDEVICE9 l_Device = My_device ;
 
LPDIRECT3DSURFACE9 l_SurfaceHDC, l_Surface;
 
My_3DTexture->GetSurfaceLevel(0,&l_Surface);
 
HDC hDC = GetDC((HWND)MyPictureBoxHWND); //use WINAPI to get my picturebox DC handle
 
l_SurfaceHDC->GetDC(&hDC);   // i think i'm wrong here but how we can copy flower image data into my surface ?
 
l_Device->StretchRect(l_SurfaceHDC,NULL, l_Surface,NULL,D3DTEXF_NONE);
 
l_SurfaceHDC->Release();
 
l_Device->SetTexture( 0,My_3DTexture);

 

 

Thanks.

Share this post


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