Get your DLL here :
DLL-files.com - d3dx9_40.dll, free download
and put it at the right place. Some games just can't get the newer libraries to work.
Also, you can install all three DX (Direct X 9.0c, Direct X 10 & 11). Direct X 11 is the one that comes with Win7. They won't conflict