Jump to content
  • Advertisement
Sign in to follow this  
browny

D3DXCreateTextureFromResource Problem

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

I am using a .tga file which i want to embed into my executable (dll). I did the following in my .rc file
#define ID_TEXTURE_CIRCLE 106
ID_TEXTURE_CIRCLE	RT_RCDATA	"circle.tga"

The .rc file gets compiled successfully. Then i am doing the following in the source file
V(D3DXCreateTextureFromResource( m_pDevice, NULL, MAKEINTRESOURCE(ID_TEXTURE_CIRCLE), &m_pPointTexture));

it gives "D3DERR_INVALIDDATA" !!! I also tried
V(D3DXCreateTextureFromResource( m_pDevice, GetModuleHandle(NULL), MAKEINTRESOURCE(ID_TEXTURE_CIRCLE), &m_pPointTexture));

Still it gives it gives "D3DERR_INVALIDDATA" !!! Could someone please give me some idea how to include a tga file into the .rc file and make D3D load it from the resource.

Share this post


Link to post
Share on other sites
Advertisement
That's what i guessed too.. but for some reason, apparently, my DllMain doesn't get called at all !! NO i am not using Resource Only DLL and my system is as follows

I have main application A, and two DLLs B, and C

in A
----
LoadLibrary(B)


And C is explicitly linked with B using export lib. So when B is loaded with LoadLibrary, C is automatically loaded. But the DllMain is not called !

Any idea. I have my resources in dll C.


Share this post


Link to post
Share on other sites
What does the signature for DllMain look like? If it's not correct, the linker won't think it's DllMain, so it won't be called.

GetModuleHandle(NULL) returns the HMODULE / HINSTANCE of the executable that loaded the DLL, not the DLL itself, so you need to use the DLL's HMODULE from DllMain.

Another thing you could try, is explicitly setting the entry point to something other than DllMain in the linker settings (Somewhere, I don't recall exacltly where)

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!