Archived

This topic is now archived and is closed to further replies.

Resources and msvc.net problem.

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

Hello, im trying to compile my game on Vc++.Net, I have run into a problem tough. I am trying to load a wave file from a resource. I am using the dsutil.h wrapper that comes with the dxsdk to load wave files. This used to work with vc++ 6.0. But now it dosnt =( I have traced it in the dsutil.cpp file to the FindResource() function, which is returning null when it shouldent. dsutil.cpp:
  
// Loading it as a file failed, so try it as a resource

            if( NULL == ( hResInfo = FindResource( NULL, strFileName, TEXT("WAVE") ) ) )
            {
                if( NULL == ( hResInfo = FindResource( NULL, strFileName, TEXT("WAV") ) ) )
                    return DXTRACE_ERR_NOMSGBOX( TEXT("FindResource"), E_FAIL );
            }
  
I tried to add this line right above that when i was searching for the error, so there is no doubt that strFileName has the name of the resource in it:
  
if(strFileName == "music1")
				MessageBox(NULL, "it''s there", "ERROR" ,MB_OK | MB_ICONEXCLAMATION);
  
music1 is the name of the resource. I dont think its anything wrong with my .rc file or resource.h. Because i can load images and icons just fine from them, and they are generated by msvc.net. I have no clue why it fails, maybe FindResource dont work on windowsXP and msvc.net?

Share this post


Link to post
Share on other sites
I have solved it and il post how to here case someone else ever get this problem.

It was very simple but stupid.

You CANNOT #define your .wav files in resource.h that msvc generates. Msvc will however, put them there by default. So you have to remove en manualy.

This must be a bug or something.

Share this post


Link to post
Share on other sites