However, if you want to play, then: public partial class Service1 : ServiceBase { public Service1() { InitializeComponent(); } protected override void OnSessionChange(SessionChangeDescription changeDescription) { switch( changeDescription.Reason ) { case SessionChangeReason.SessionLogon: // user logon // // todo: // create a UI process in the user's desktop. // you could use CreateProcessAsUser() API or DCOM mechanism. // Remember that Vista no longer supports 'interactive service' // break; case SessionChangeReason.SessionLogoff: // user logoff break; } } }
However, if you want to play, then:
public partial class Service1 : ServiceBase
{
public Service1()
{
InitializeComponent();
} protected override void OnSessionChange(SessionChangeDescription changeDescription)
{
switch( changeDescription.Reason )
{
case SessionChangeReason.SessionLogon:
// user logon //
// todo:
// create a UI process in the user's desktop.
// you could use CreateProcessAsUser() API or DCOM mechanism.
// Remember that Vista no longer supports 'interactive service'
//
break;
case SessionChangeReason.SessionLogoff:
// user logoff
break;
}
}
}
http://blog.csdn.net/zhzuo/archive/2005/04/14/347712.aspx