hi there,

i have a DLL for that handles some DirectX stuff for me. what i want to do is inside the DLL is load a resource [in this case its a bitmap, with IDB_SPRITE_DOT] so i can use it as a texture file.

so the problem is when i went to access the DLL's resource (IDB_SPRITE_DOT)... i couldn't, becasue the current resource handle belonged to the application, not the DLL, which makes sense.

so what i thought i could do is this, inside the DLL:

Code:
//get handle to the applications resources 
HINSTANCE hOldResourceHandle = AfxGetResourceHandle();

//get handle to the dll's resources 
HINSTANCE hNewResourceHandle = AfxGetInstanceHandle();

//set the resource handle to be the DLL's
AfxSetResourceHandle(hNewResourceHandle);

//we should now be able to access the resource 'IDB_SPRITE_DOT' 
//which is built into this DLL...
HRESULT hr = D3DXCreateTextureFromResource(m_pD3DDevice, NULL, MAKEINTRESOURCE(IDB_SPRITE_DOT), &m_pSpriteTexture);

//set the resource handle back to being the application's
AfxSetResourceHandle(hOldResourceHandle);
however, it doesn't work!! when i call AfxGetInstanceHandle() i get a handle to the application's resources again. i.e. hOldResourceHandle == hNewResourceHandle!

so anyone know what i'm doing wrong, or is there another way of acheiving what i want?? from the MSDN documentation, this should work! help please!! thanks in advance.