Posted December 15, 20222 yr 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?
December 15, 20222 yr 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.
December 15, 20222 yr Author 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, 20222 yr by Bang1338
December 16, 20222 yr Author 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)
April 29, 20232 yr Author 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
April 29, 20232 yr Author Turn out this line of code: hResource = FindResourceA(NULL, MAKEINTRESOURCE(IDR_BASS), "BINARY"); Give the null, so... Edited April 29, 20232 yr by Bang1338
Create an account or sign in to comment