If you use the EasyHID USB Wizard (comes with MicroCode Studio), it generates a sample program in Delphi for you.