You have a number of options for creating a process that runs under a different user from the parent process:
CreateProcessAsUser
orCreateProcessWithTokenW
. These require you to obtain a primary token that represents a user, calling eitherLogonUser
orDuplicateTokenEx
.CreateProcessWithLogonW
which allows you to specify the user name and password as parameters.
However, if you want the process that you create to appear on the interactive desktop, you need to do quite a bit of work. This article covers the details: Launching an interactive process from Windows Service in Windows Vista and later.