Is there a way in my exe program i can register a dll as a service ?

If so please try and give code samples