I already wrote about Windows 7 API for virtual disk support (for beta and release candidate).
Just as reminder, this is .NET implementation of Virtual disk Windows API. That enables you to create and attach (and few other things) virtual disks (.vhd) directly from C#.
This version can be downloaded here here. For shorter and more focused view, you can check open and create examples. Although they were written while Windows 7 was in release candidate, they do remain valid.