Author Topic: BASS.net WPF Forms C# BASS_Init this.Handle not working  (Read 283 times)

francis57

  • Posts: 37
Hello,

in Windows Forms this is working:
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle)

but in WPF Forms this.Handle not exists, is not compiling. Therefore I got following code, which compiles fine:

var winHandle = new WindowInteropHelper(this).Handle;
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, winHandle )

but I get the error message when window is being loaded:

System.TypeInitializationException: "The type initializer for 'Un4seen.Bass.Bass' threw an exception."
BadImageFormatException An attempt was made to load a file with an incorrect format. (0x8007000B)


Thanks for any help, Francis
« Last Edit: 15 Feb '24 - 17:49 by francis57 »

francis57

  • Posts: 37
I found the solution. Using the x64 dlls solved the problem.