I'm pretty sure the 40D has no limitation on CF card size (i.e. whatever is within the CF spec can be used). I see on the web that others are successfully using 32GB cards.
I believe all canon cameras will show "999" remaining if the capacity of the card exceeds 1000 images. It will continue to show this until you go below 1000 shots of remaining capacity. In other words, once you fill up the card sufficiently so that you can only fit 999 more shots (or less), you'll begin to see the remaining shot counter decrement.
Take Care,
Eric