The differences between those two lenses are:
1) Sharpness and quality - MUCH better on the 17-40. It's L glass so very very high quality, it's a professional grade lens.
2) Build quality. The 17-40 is made of metal, the 10-22 is made of plasic. It's much stronger. Also weather sealed if you get a UV filter for it (dosen't make it waterproof, but you could drop it into a puddle and it would be fine, or if, say, someone split a drink all over it like someone did to mine the other night).
3) the 10-22 is an EF-S not EF lens which means you can't use it on full-frame bodies (not a big problem as you want it for a 400D, but perhaps in the future it would be annoying to replace).
I have a 17-40 L and absolutely love it. I had a 28-135mm and L seris lenses are worth the money on build quality alone!
Of course it's more expensive, a 17-40 will set you back around £400, but it's definatly worth it. The 400D can make good use of higher quality lenses aswel, as it has that 10.1MP sensor.