Click here to Skip to main content
15,926,443 members
Home / Discussions / C#
   

C#

 
Generalclipboard Pin
cmarmr21-Mar-04 16:49
cmarmr21-Mar-04 16:49 
GeneralRe: clipboard Pin
Heath Stewart21-Mar-04 18:51
protectorHeath Stewart21-Mar-04 18:51 
GeneralRe: clipboard Pin
cmarmr22-Mar-04 9:45
cmarmr22-Mar-04 9:45 
GeneralRe: clipboard Pin
Heath Stewart22-Mar-04 9:52
protectorHeath Stewart22-Mar-04 9:52 
GeneralRe: clipboard Pin
cmarmr23-Mar-04 3:47
cmarmr23-Mar-04 3:47 
Generalanyone help me!! Pin
lcsnatoo21-Mar-04 16:05
lcsnatoo21-Mar-04 16:05 
GeneralRe: anyone help me!! Pin
Heath Stewart21-Mar-04 18:46
protectorHeath Stewart21-Mar-04 18:46 
Questioncode to keep checking the OS if connected to the net? Pin
User 96257821-Mar-04 14:06
User 96257821-Mar-04 14:06 
AnswerRe: code to keep checking the OS if connected to the net? Pin
Spanky321-Mar-04 21:16
Spanky321-Mar-04 21:16 
GeneralRe: code to keep checking the OS if connected to the net? Pin
User 96257822-Mar-04 6:45
User 96257822-Mar-04 6:45 
GeneralRe: code to keep checking the OS if connected to the net? Pin
Spanky322-Mar-04 7:19
Spanky322-Mar-04 7:19 
GeneralTotal crash & reboot in XP pro Pin
quilkin21-Mar-04 13:02
quilkin21-Mar-04 13:02 
GeneralRe: Total crash & reboot in XP pro Pin
Heath Stewart21-Mar-04 14:02
protectorHeath Stewart21-Mar-04 14:02 
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 

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.