Not sure about Canon 40D, but for Canon 300D, the common understanding is to look at the Folder # and File # (assuming the CF card you are using has not been used on a different camera, I think).
So for example, the latest pics I took on a Canon 300D was placed in Folder #329 and File=IMG_2956, then the formula is ((Folder-100)*100)+56, because the Folder starts with 100, you multiply by 100 because each folder should hold an average of 97-100 pics, and the first 2 digits of the File Name refers to the last 2 digits of the Folder. Given the above example, then I deduce that this 300D should have taken ((329-100)*100)+56=22900+56=22956 shutter actuations performed.
If your 40D is relatively new, try the above formula and see if it gives you a close estimate.