Link to home
Start Free TrialLog in
Avatar of andy148
andy148

asked on

How to detect when a user logs on from a vb service

I have a vb program that runs as a service. I currently have code that can get the user that is currently logged in, but I have no idea when to run it, so it is currently in a timer. All I need is an event that is triggered when a user logs on. I attatched the code I use to get the current user in case anyone is interested.
Dim User As String = ""
            Dim q1 As New ManagementObjectSearcher("select * from Win32_ComputerSystem")
            Dim qc As ManagementObjectCollection = q1.Get
            For Each Mo As ManagementObject In qc
                User = Mo("username")
                Exit For
            Next

Open in new window

Avatar of SameerJagdale
SameerJagdale
Flag of United States of America image

Avatar of andy148
andy148

ASKER

I tried the link, but it didn't help much, I'm looking for an event that is fired when a user logs in, preferably without changing any settings on their computer.
ASKER CERTIFIED SOLUTION
Avatar of SameerJagdale
SameerJagdale
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andy148

ASKER

thanks!!