Jump to content
  • Advertisement
Sign in to follow this  

D3DXCreateTextureFromResource Problem

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

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
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

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.

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!