When I try to take photos I hear a strange shutter sound and I get the message 'Error: Press shutter release button again'. When I remove the lens I can see that the mirror is raised and the shutter is closed, covering the sensor. When I press the button again the mirror lowers and the error message goes away until I try to take another photo. I've tried opening the bottom and moving the red gear but it didn't help. The camera hasn't been used that much either. I also just discovered that the bottom half of the shutter never moves at all, does it being stuck have anything to do with the mirror not wanting to go back down after a shot?
If you have followed the procedure outlined in this video to free the red gear inside the bottom of your camera and it hasn't corrected the problem, it is probably time to write off your D40x. There are plenty of other places on the web that give slightly different variations of the same procedure. Some users have had success using mirror lockup or the manual cleaning setting (which locks up the mirror) to get the wheel to free up.
Sending it in for servicing will likely cost more than the camera is worth.