Tricks with D3DX10GetImageInfoFromResource


I am playing with D3D10 tonight, and I am trying to get D3DX10GetImageInfoFromResource to work for me. I have beaten on it for a long time, and it still resists my powers.


On a whim I write some code to call FindResource myself to make sure that I can find the resource and it works, but that makes me think about the resource types on this page:


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/WindowsUserInterface/Resources/IntroductiontoResources/resourcereference/resourcetypes.asp


And then I remember that some other D3D resource functions like resources to be in RC_RCDATA format. Lo and behold, this is the problem – I had a bmp file as a resource, but it was marked with RC_BITMAP!


Lesson learned – D3D loads RC_RCDATA resources, even when they are bitmaps. I hope this saves somebody some time one day 🙂

Comments (4)

  1. jeffdav says:

    Yep.  Most things that load resources have some specific list of types they support.  It’s not always clear what those types are from the documentation, unfortunately.

    For example, IE’s res:// protocol only supports RT_HTML or RT_FILE.  I spent a few hours debugging the same thing to discover that.  🙂

  2. Paul Roussin says:

    A great many thanks!

    I spent hours on this. I thought I had created a bitmap in RC_RCDATA using the bitmap import  button and never saw that it created an RC_BITMAP resource. After reading your comments I went back and noticed where it was located. Now it works!!!

    Thanks again,

    Paul Roussin

  3. Morpheus says:

    I wasn’t aware about this 🙁

    -Morpheus

    http://wpfcontrols.blogspot.com

  4. Stefan says:

    Thanks a lot!

    Cheers,

    Stefan