Click here to Skip to main content
15,923,910 members
Home / Discussions / C#
   

C#

 
GeneralRe: Total crash & reboot in XP pro Pin
Werdna21-Mar-04 16:24
Werdna21-Mar-04 16:24 
GeneralRe: Total crash & reboot in XP pro Pin
quilkin23-Mar-04 6:30
quilkin23-Mar-04 6:30 
GeneralCatch event without loading control on postback Pin
Zandman21-Mar-04 8:30
Zandman21-Mar-04 8:30 
GeneralRe: Catch event without loading control on postback Pin
mhmoud rawas21-Mar-04 8:54
mhmoud rawas21-Mar-04 8:54 
GeneralRe: Catch event without loading control on postback Pin
Zandman21-Mar-04 9:51
Zandman21-Mar-04 9:51 
GeneralRe: Catch event without loading control on postback Pin
Heath Stewart21-Mar-04 14:06
protectorHeath Stewart21-Mar-04 14:06 
GeneralWhen did user logon Pin
RickZ21-Mar-04 8:30
RickZ21-Mar-04 8:30 
GeneralRe: When did user logon Pin
Heath Stewart21-Mar-04 13:58
protectorHeath Stewart21-Mar-04 13:58 
A service always runs as the user under which it's configured to run. If your service is configured to run as SYSTEM, then it will always run as SYSTEM when the service is started (at startup if configured as such, which is the default behavior). Many services will implement APIs that impersonate users but still can only run as a certain account (like SYSTEM).

If you want to moniter when other users log in (since your service is continually running despites whether or not someone's logged in), then you need to monitor system events. The .NET FCL (Framework Class Library) exposes no such APIs, so you'll have to use unmanaged code through COM interop or P/Invoke.

If you're limited from checking security events, then you could use WMI and handle an event query for the Win32_LogonSession WMI class. The details are buried in Microsoft implementations and all you have to do is register to receive an event when something changes. See the class documentation for the System.Management namespace and see MSDN Magazine[^] for several good articles (including links to more information and a good WMI plugin for VS.NET's Server Explorer (beta for 2002, released for 2003 - but both work good).

 

Microsoft MVP, Visual C#
My Articles
GeneralNeed a Book to Teach By Pin
Sirusdv21-Mar-04 8:30
Sirusdv21-Mar-04 8:30 
GeneralRe: Need a Book to Teach By Pin
Heath Stewart21-Mar-04 13:35
protectorHeath Stewart21-Mar-04 13:35 
GeneralRe: Need a Book to Teach By Pin
Spanky321-Mar-04 21:24
Spanky321-Mar-04 21:24 
GeneralPlaying .wma with license Pin
Member 20107421-Mar-04 3:00
Member 20107421-Mar-04 3:00 
QuestionHow to downlaod a picture ? Pin
gr8tushar20-Mar-04 23:56
gr8tushar20-Mar-04 23:56 
AnswerRe: How to downlaod a picture ? Pin
Nick Parker21-Mar-04 7:07
protectorNick Parker21-Mar-04 7:07 
GeneralInformation of DataSet to DataBase !! Pin
ElJerry20-Mar-04 21:24
ElJerry20-Mar-04 21:24 
GeneralRe: Information of DataSet to DataBase !! Pin
Spanky321-Mar-04 3:59
Spanky321-Mar-04 3:59 
GeneralRe: Information of DataSet to DataBase !! Pin
Heath Stewart21-Mar-04 13:24
protectorHeath Stewart21-Mar-04 13:24 
GeneralBindable(true) Pin
Festus Redelinghuys20-Mar-04 20:22
Festus Redelinghuys20-Mar-04 20:22 
GeneralRe: Bindable(true) Pin
Heath Stewart21-Mar-04 13:22
protectorHeath Stewart21-Mar-04 13:22 
GeneralRe: Bindable(true) Pin
Festus Redelinghuys21-Mar-04 16:08
Festus Redelinghuys21-Mar-04 16:08 
GeneralTransparent Trackbar Pin
kaptaintens20-Mar-04 16:11
kaptaintens20-Mar-04 16:11 
GeneralRe: Transparent Trackbar Pin
Mazdak20-Mar-04 20:11
Mazdak20-Mar-04 20:11 
GeneralRe: Transparent Trackbar Pin
kaptaintens20-Mar-04 21:21
kaptaintens20-Mar-04 21:21 
GeneralRe: Transparent Trackbar Pin
Anonymous21-Mar-04 13:15
Anonymous21-Mar-04 13:15 
Generalembedded chm Pin
bisquic20-Mar-04 11:34
bisquic20-Mar-04 11:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.