Andreas,
So it sounds like what you want to do is write an application that performs the following actions:
1) Poll the CD1/CD2 pins at some interval to determine when a CF card has been inserted or removed.
2) Based on the presence (or lack thereof) of a CF card, you want the CE filesystem to mount or unmount the CF card as a block device.
It sounds like your well on your way to handling step 1. As far as step two goes, I don't have any direct experience with it. However, the Windows CE help file has a section on the Storage Manager. In the "Storage Manager Reference" several functions (APIs) are listed including; DismountPartition, MountPartition, DismountStore, OpenStore, etc. So, I guess I would poke around there and see if some of those functions will suite your needs.
You can also try the Windows CE newsgroups. I typically head to the DejaNews versions here:
http://groups.google.com/...indowsce.platbuilder
Best regards,
--mikee