Re: Getting logged in user from a service?



Your example looked like it would block when the monitored app ran (until
it stopped?) - is that right? Not tried it yet.
Plus, manu users are still on W2k so if the Win32_ProcessStartTrace option
is XP or above, it may not be suitable.
Thanks though!

Whatever method you choose, you'll still have to factor in what happens if
the service is stopped and then re-started (given that the app you're
monitoring may already be running at this point - or rather this is usually
an issue unless your app is dependent on the service in some way). I don't
know what WMI classes you should rely on off-hand to assist in this area (to
enumerate and locate running processes) since I normally rely on the the
WinAPI itself. In this regard Nicholas' technique is more mainstream (really
the de facto way of doing things) though WMI is normally easier (and worth
considering on those merits though I'd personally stick with the WinAPI
because it is more mainstream).


.


Loading