the service application must be marked as "interactive". This allows your service to interact with the desktop.
This requires modifying a registry key: you must bitwise-or the type entry for your service with 0x100 (this is the value for SERVICE_INTERACTIVE_PROCESS according to Winnt.h). The exact location and name of this registry entry varies. For example:
You need to adjust the service application timeout. Otherwise, the service application will be killed within 20 seconds after starting. Adjusting the timeout involves setting an entry in the following registry key:
Under this key, create a DWORD data value called ServicesPipeTimeout. Set this entry to the amount of time in milliseconds that you want the service to wait before timing out. For example, 60,000 is one minute, while 86,400,000 is 24 hours.