>How can I associate a certain file extension
(.xp in my case) with my application.
>
Youi need to create a set of registry entries under HKEY_CLASSES_ROOT that directs Windows to fire your application when a user clicks on a file with that extension from explorer or launches it from ShellExecute(). The easiest way to do this is to create the relation using the Windows Explorer's View/Folder Options/File Types dialog. The same effects can be achieved programmatically by creating the needed registry hierarchy for the file extension under HKEY_CLASSES_ROOT.
You can examine the structure of a relationship on your system using REGEDIT.