Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. How to capture the logon and logoff events in Windows Vista?

How to capture the logon and logoff events in Windows Vista?

Scheduled Pinned Locked Moved Windows API
tutorialquestion
14 Posts 5 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Mark Salsbery

    Vaibhav Deshpande wrote:

    Thank you Sir!!!!

    You're welcome!  And you can call me Mark ;P

    Mark Salsbery Microsoft MVP - Visual C++ :java:

    J Offline
    J Offline
    JudyL_MD
    wrote on last edited by
    #5

    Sir Mark :laugh:

    M 1 Reply Last reply
    0
    • J JudyL_MD

      Sir Mark :laugh:

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #6

      :doh:  ;P

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      J 1 Reply Last reply
      0
      • M Mark Salsbery

        :doh:  ;P

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        J Offline
        J Offline
        JudyL_MD
        wrote on last edited by
        #7

        Sorry, was watching the first Star Wars last weekend, and your comment was straight out of the movie Judy

        M 1 Reply Last reply
        0
        • J JudyL_MD

          Sorry, was watching the first Star Wars last weekend, and your comment was straight out of the movie Judy

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #8

          :-D

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          • M Mark Salsbery

            Vaibhav Deshpande wrote:

            I have used handlerEx function to capture the on session change event but I m unable to capture the login, logoff events.

            What if, after you call RegisterServiceCtrlHandlerEx() to set your HandlerEx() function, you call SetServiceStatus() with SERVICE_ACCEPT_SESSIONCHANGE in the dwControlsAccepted field of the SEVICE_STATUS struct?  Do you get the notifications then? Mark

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            J Offline
            J Offline
            jamalhaider
            wrote on last edited by
            #9

            Hi, I am trying to develop Win logOn Notification for Vista. My RegisterServiceCtrlHandlerEx() successfully set my HandelrEx() function however I am not able to receive Lock, Logon and logoff events. Moreover as suggested I am also calling SetServiceStatus() with SERVICE_ACCEPT_SESSIONCHANGE in the dwControlsAccepted field of the SEVICE_STATUS struct. The only notification I am getting at the moment in my HandlerEx() fuction is SERVICE_STOPPED. I am using C# for development. Please help me.

            M 1 Reply Last reply
            0
            • J jamalhaider

              Hi, I am trying to develop Win logOn Notification for Vista. My RegisterServiceCtrlHandlerEx() successfully set my HandelrEx() function however I am not able to receive Lock, Logon and logoff events. Moreover as suggested I am also calling SetServiceStatus() with SERVICE_ACCEPT_SESSIONCHANGE in the dwControlsAccepted field of the SEVICE_STATUS struct. The only notification I am getting at the moment in my HandlerEx() fuction is SERVICE_STOPPED. I am using C# for development. Please help me.

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #10

              If you're using C#, then using the .NET service classes should be easier... Override ServiceBase.OnSessionChange(). Mark

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              J M 2 Replies Last reply
              0
              • M Mark Salsbery

                If you're using C#, then using the .NET service classes should be easier... Override ServiceBase.OnSessionChange(). Mark

                Mark Salsbery Microsoft MVP - Visual C++ :java:

                J Offline
                J Offline
                jamalhaider
                wrote on last edited by
                #11

                Thanks Mark :) It works like a charm. Thanks again.

                1 Reply Last reply
                0
                • M Mark Salsbery

                  If you're using C#, then using the .NET service classes should be easier... Override ServiceBase.OnSessionChange(). Mark

                  Mark Salsbery Microsoft MVP - Visual C++ :java:

                  M Offline
                  M Offline
                  Moshe Yada
                  wrote on last edited by
                  #12

                  Hi, I'm also encountering this problem. However, I'm using C++ ... Any idea? Thanks in advance, Moshe.

                  M M 2 Replies Last reply
                  0
                  • M Moshe Yada

                    Hi, I'm also encountering this problem. However, I'm using C++ ... Any idea? Thanks in advance, Moshe.

                    M Offline
                    M Offline
                    Mark Salsbery
                    wrote on last edited by
                    #13

                    Moshe Yada wrote:

                    I'm also encountering this problem. However, I'm using C++ ...

                    You mean not getting session change events in your service? If so, does this[^] help? Mark

                    Mark Salsbery Microsoft MVP - Visual C++ :java:

                    1 Reply Last reply
                    0
                    • M Moshe Yada

                      Hi, I'm also encountering this problem. However, I'm using C++ ... Any idea? Thanks in advance, Moshe.

                      M Offline
                      M Offline
                      Moshe Yada
                      wrote on last edited by
                      #14

                      "I am trying to develop Win logOn Notification for Vista. My RegisterServiceCtrlHandlerEx() successfully set my HandelrEx() function however I am not able to receive Lock, Logon and logoff events. Moreover as suggested I am also calling SetServiceStatus() with SERVICE_ACCEPT_SESSIONCHANGE in the dwControlsAccepted field of the SEVICE_STATUS struct. The only notification I am getting at the moment in my HandlerEx() fuction is SERVICE_STOPPED." I am using C++ with a generated code using VS2005 of Win32Service, so I call RegisterServiceCtrlHandlerEx() and SetServiceStatus() from within OnStart(). Thanks in advance for your help, Moshe

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups