Note: I assume you can rebuild the program you are having problems with because changes in its configuration settings are required.
If you are struggling with this problem you are probably running 64bit OS and executing 64bit exe that loads 32bit dll, or the other way – 32bit OS on which 32bit exe tries loading 64bit dll. For the sake of this post, let’s assume this is the former matter.
You need to assure that 32bit dll is loaded by the program with the same bittness, even if it’s running on 64bit platform.
In order to achieve that you need to change the configuration settings of the project whose outcome is that exe so that platform target is always x86, disregarding configuration platform. Let’s assume that program is written in C#.
Open project’s properties, go to Build tab and make change as below: