宁 波
2007-Aug-27 19:17 UTC
[Vorbis-dev] play ogg in a package file by ov_oepn(), return OV_EBADLINK
hi all: i have a package file "sound.dll",consist many ogg files; my code: --------------------------------------------------------------------------------------- //----- open OGG file HANDLE handle_dll; handle_dll=LoadLibrary("RESOURCE\\sound.dll"); HRSRC handle_resource; HGLOBAL handle_memory; void *pointer; DWORD size; //Load custom resource in DLL handle_resource=FindResource((HINSTANCE)handle_dll,GetFileName().c_str(),"oggvorbis"); handle_memory=LoadResource((HINSTANCE)handle_dll,handle_resource); size=SizeofResource((HINSTANCE)handle_dll,handle_resource); //Get pointer of custom resource pointer=LockResource((HINSTANCE)handle_memory); //get a handle to the file FILE *fileHandle = fopen("RESOURCE\\sound.dll", "rb"); if(!fileHandle) return false; //test to make sure that the file was opened succesfully int a=ov_open( fileHandle, &m_vorbisFile, (char*)pointer,size); -------------------------------------------------------------------------- i can open and play the first ogg file in the sound.dll file,when open the 2nd,3rd...alaways retrun OV_EBADLINK -137. i run the code with vc2005 and winxp. any idea, Thank You. _________________________________________________________________ ?????????????? MSN Messenger: http://messenger.msn.com/cn