Bang1338 Posted December 15, 2022 Posted December 15, 2022 Hi, I'm trying to make my program to play tracker This time, i'm using BASS hResource = FindResource(NULL, MAKEINTRESOURCE(IDR_BASS), "BINARY"); hResourceLoaded = LoadResource(NULL, hResource); lpBuffer = (LPBYTE)LockResource(hResourceLoaded); dwFileSize = SizeofResource(0, hResource); GetTempPath(MAX_PATH, szTempName); GetTempFileName(szTempName, "MOD", 0, szTempName); hFile = CreateFile(szTempName,GENERIC_READ | GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); WriteFile(hFile, lpBuffer, dwFileSize, &dwBytesWritten, 0); CloseHandle(hFile); hLibrary = LoadLibrary(szTempName); BASS_MusicLoadAddr = (BassMusicLoad)GetProcAddress(hLibrary, "BASS_MusicLoad"); BASS_InitAddr = (BassInit)GetProcAddress(hLibrary, "BASS_Init"); BASS_FreeAddr = (BassFree)GetProcAddress(hLibrary, "BASS_Free"); BASS_ChannelPlayAddr = (BassChannelPlay)GetProcAddress(hLibrary, "BASS_ChannelPlay"); BASS_ChannelStopAddr = (BassChannelStop)GetProcAddress(hLibrary, "BASS_ChannelStop"); BASS_SetVolumeAddr = (BassSetVolume)GetProcAddress(hLibrary, "BASS_SetVolume"); BASS_ChannelIsActiveAddr = (BassChannelIsActive)GetProcAddress(hLibrary, "BASS_ChannelIsActive"); BASS_ErrorGetCodeAddr = (BassErrorGetCode)GetProcAddress(hLibrary, "BASS_ErrorGetCode"); BASS_InitAddr(-1, 44100, BASS_DEVICE_NOSPEAKER, hwndDlg, NULL); hResource2 = FindResource(NULL, MAKEINTRESOURCE(IDR_SONG), "BINARY"); dwFileSize2 = SizeofResource(NULL, hResource2); hResourceLoaded2 = LoadResource(NULL, hResource2); hSong = LockResource(hResourceLoaded2); hMusic = BASS_MusicLoadAddr(TRUE, hSong, 0, dwFileSize2, BASS_MUSIC_LOOP | BASS_MUSIC_RAMPS | BASS_MUSIC_SURROUND2, 44100); BASS_ChannelPlayAddr(hMusic, FALSE); however, this happened: My guess is this line caused the error lpBuffer = (LPBYTE)LockResource(hResourceLoaded); dwFileSize = SizeofResource(0, hResource); GetTempPath(MAX_PATH, szTempName); GetTempFileName(szTempName, "MOD", 0, szTempName); hFile = CreateFile(szTempName,GENERIC_READ | GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); WriteFile(hFile, lpBuffer, dwFileSize, &dwBytesWritten, 0); Do you know where i'm wrong and how can i fix this issues?
kao Posted December 15, 2022 Posted December 15, 2022 Looks like the call to LoadLibrary failed. Most likely reasons: your code is 64bit but the DLL is 32bit (or vice versa), or your machine is missing some Microsoft Redistributable package that BASS requires.
Bang1338 Posted December 15, 2022 Author Posted December 15, 2022 (edited) 6 hours ago, kao said: Looks like the call to LoadLibrary failed. Most likely reasons: your code is 64bit but the DLL is 32bit (or vice versa), or your machine is missing some Microsoft Redistributable package that BASS requires. I forgot to mention that when file exported to temp but it's not writen I used basstest.c from asmcommunity (http://www.asmcommunity.net/forums/topic/?id=25338) basstest.c Extra: How to change 64bit to 32bit? Edited December 15, 2022 by Bang1338
Bang1338 Posted December 16, 2022 Author Posted December 16, 2022 23 hours ago, kao said: Looks like the call to LoadLibrary failed. Most likely reasons: your code is 64bit but the DLL is 32bit (or vice versa), or your machine is missing some Microsoft Redistributable package that BASS requires. When I changed to compile 32bit, I got this: error: ld returned 1 exit status Added options (codeblocks): Project > Build Options > General > Target x86 (32 bit) also tried: Settings > Compiler > General > Target x86 (32 bit)
Bang1338 Posted April 29, 2023 Author Posted April 29, 2023 On 12/15/2022 at 11:17 PM, kao said: Looks like the call to LoadLibrary failed. Most likely reasons: your code is 64bit but the DLL is 32bit (or vice versa), or your machine is missing some Microsoft Redistributable package that BASS requires. I tried in WindowsXP VM, but this still happening
Bang1338 Posted April 29, 2023 Author Posted April 29, 2023 (edited) Turn out this line of code: hResource = FindResourceA(NULL, MAKEINTRESOURCE(IDR_BASS), "BINARY"); Give the null, so... Edited April 29, 2023 by Bang1338
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now