I got this problem while trying to run South Park: The Stick of Truth on my PC. When I went to the internet to find a fix for the issue, I couldn't find much so I decided to write up a post on how I fixed it.
The first thing you want to make sure, is that you have the latest version of DirectX.
I found this post on Steam Community but the fix didn't work for me. I still got the same "Failed to load DX9 DLLs" error.
What worked for me was installing a DirectX redistribute. Download here.
After downloading you should get an executable. I installed the redist. in a new folder in my South Park game folder. After installing, you should get a large amount of archive files. Unzip all of them using a tool like WinRAR and after you should see another executable called "DXSETUP.exe". Run and install that.
After everything is done, you should be able to run your game, whether it's South Park: Stick Of Truth, or something else.