I have the Canon flash 580 EX II and I have it set to ETTL but it really is ETTL II.
The flash will be working in combination with body of the camera and in turn the lens. However, it also depends on the Canon body you have. There are a number of settings within the Canon 40D that can be configured for an external flash. Have you set these?
As Gordon has mentioned, use ETTL. There is the manual setting for compensation, zoom and the like but ideally the flash should be a last resort. Many professionals will suggest increasing the ISO instead of using the flash. In many instances, the flash can make an otherwise warm but enchanting photo harsh. So you need to trial and error with ISO’s, say up to 400, the camera exposure and so forth. Then take the same image with the flash. It’s a learning experience that can only be achieved through taking images and analysing them.
You can a bounce the light emitted from the flash off a light ceiling or back wall, or use a diffuser to soften the light emitted and so forth.
Flash photography is a detailed and expert area, and goes beyond a single external flash, to flash slaves and studio lighting. An understand in the physics of light and photography would be handy to understand too.
This may sound contradictory, but flash can be used effectively as fill in an outdoor shoot and not use in an indoor shot to great effect.
Canon EOS 40D, Canon EF 24-70 F/2.8L USM, Canon SL 580 EX Mark II, Canon Battery Flash Unit CP-E4, Canon BG-E2N (Battery Grip), Canon Right Angle Finder C, B+W 77mm Kaeseman CP (MRC) Filter, B+W 77mm UV Haze 010 (MRC) Filter, Canon Timer RC TC-80N3, etc.