You may find the TypeToVal and ValToType methods in the class on this page:
http://fox.wikis.com/wc.dll?Wiki~ApiStructureClass useful. They were written before VFP9, and so had to do without the enhanced bintoc, etc, so they should give you a head start, if not be exactly what you need.