ISenslogon

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leigh Webber

    ISenslogon

    Does anyone have an example of VB.Net code that uses the ISenslogon
    interface? The documentation says to "subscribe to the SENS events that
    interest you" and to "create a sink object". Whazza?

    I want to be notified when the display has been unlocked or the ScreenSaver
    has been stopped. If someone can get me started with a simple example in VB,
    that would be great.
  • CJ Taylor

    #2
    Re: ISenslogon

    Event Sinks = Event Handlers [procedures]

    i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <- [Your event
    sink method]

    "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
    news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...[color=blue]
    > Does anyone have an example of VB.Net code that uses the ISenslogon
    > interface? The documentation says to "subscribe to the SENS events that
    > interest you" and to "create a sink object". Whazza?
    >
    > I want to be notified when the display has been unlocked or the[/color]
    ScreenSaver[color=blue]
    > has been stopped. If someone can get me started with a simple example in[/color]
    VB,[color=blue]
    > that would be great.[/color]


    Comment

    • CJ Taylor

      #3
      Re: ISenslogon

      Event Sinks = Event Handlers [procedures]

      i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <- [Your event
      sink method]

      "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
      news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...[color=blue]
      > Does anyone have an example of VB.Net code that uses the ISenslogon
      > interface? The documentation says to "subscribe to the SENS events that
      > interest you" and to "create a sink object". Whazza?
      >
      > I want to be notified when the display has been unlocked or the[/color]
      ScreenSaver[color=blue]
      > has been stopped. If someone can get me started with a simple example in[/color]
      VB,[color=blue]
      > that would be great.[/color]


      Comment

      • Leigh Webber

        #4
        Re: ISenslogon

        Thanks, CJ -- but the little details still escape me. Let's say I have a
        simple Winform app with a btnStart button:

        Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
        System.EventArg s) Handles btnStart.Click

        'What goes in here? Let's say I want to write the current time
        'to Me.txtScreenUnl ocked when the DisplayUnlock event fires.

        End Sub

        "CJ Taylor" wrote:
        [color=blue]
        > Event Sinks = Event Handlers [procedures]
        >
        > i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <- [Your event
        > sink method]
        >
        > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
        > news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...[color=green]
        > > Does anyone have an example of VB.Net code that uses the ISenslogon
        > > interface? The documentation says to "subscribe to the SENS events that
        > > interest you" and to "create a sink object". Whazza?
        > >
        > > I want to be notified when the display has been unlocked or the[/color]
        > ScreenSaver[color=green]
        > > has been stopped. If someone can get me started with a simple example in[/color]
        > VB,[color=green]
        > > that would be great.[/color]
        >
        >
        >[/color]

        Comment

        • Leigh Webber

          #5
          Re: ISenslogon

          Thanks, CJ -- but the little details still escape me. Let's say I have a
          simple Winform app with a btnStart button:

          Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
          System.EventArg s) Handles btnStart.Click

          'What goes in here? Let's say I want to write the current time
          'to Me.txtScreenUnl ocked when the DisplayUnlock event fires.

          End Sub

          "CJ Taylor" wrote:
          [color=blue]
          > Event Sinks = Event Handlers [procedures]
          >
          > i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <- [Your event
          > sink method]
          >
          > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
          > news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...[color=green]
          > > Does anyone have an example of VB.Net code that uses the ISenslogon
          > > interface? The documentation says to "subscribe to the SENS events that
          > > interest you" and to "create a sink object". Whazza?
          > >
          > > I want to be notified when the display has been unlocked or the[/color]
          > ScreenSaver[color=green]
          > > has been stopped. If someone can get me started with a simple example in[/color]
          > VB,[color=green]
          > > that would be great.[/color]
          >
          >
          >[/color]

          Comment

          • CJ Taylor

            #6
            Re: ISenslogon

            Hi Leigh,

            This is actually an event sink itself (note the handles clause, which can be
            used when a variable is declared WithEvents). If you look up in your
            Windows Forms Designer Generated Code Region you will see btnStart is
            declared

            Private WithEvents btnStart as System.Windows. Forms.Button

            Which allows you to use the handles clause (and intellisense works well with
            it)...

            but enough about that..

            Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
            System.EventArg s) Handles btnStart.Click

            AddHandler objContainingEv ent.DisplayUnlo ck, AddressOf MyEventHandler

            End Sub


            Private Sub MyEventHandler( sender as object, e as System.EventArg s)

            me.txtScreenUnl ocked = Now().ToString( )


            End Sub

            "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
            news:8EBFB13A-DFF4-486C-AC61-30B7CFDC5C7C@mi crosoft.com...[color=blue]
            > Thanks, CJ -- but the little details still escape me. Let's say I have a
            > simple Winform app with a btnStart button:
            >
            > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
            > System.EventArg s) Handles btnStart.Click
            >
            > 'What goes in here? Let's say I want to write the current time
            > 'to Me.txtScreenUnl ocked when the DisplayUnlock event fires.
            >
            > End Sub
            >
            > "CJ Taylor" wrote:
            >[color=green]
            > > Event Sinks = Event Handlers [procedures]
            > >
            > > i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <- [Your event
            > > sink method]
            > >
            > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
            > > news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...[color=darkred]
            > > > Does anyone have an example of VB.Net code that uses the ISenslogon
            > > > interface? The documentation says to "subscribe to the SENS events[/color][/color][/color]
            that[color=blue][color=green][color=darkred]
            > > > interest you" and to "create a sink object". Whazza?
            > > >
            > > > I want to be notified when the display has been unlocked or the[/color]
            > > ScreenSaver[color=darkred]
            > > > has been stopped. If someone can get me started with a simple example[/color][/color][/color]
            in[color=blue][color=green]
            > > VB,[color=darkred]
            > > > that would be great.[/color]
            > >
            > >
            > >[/color][/color]


            Comment

            • CJ Taylor

              #7
              Re: ISenslogon

              Hi Leigh,

              This is actually an event sink itself (note the handles clause, which can be
              used when a variable is declared WithEvents). If you look up in your
              Windows Forms Designer Generated Code Region you will see btnStart is
              declared

              Private WithEvents btnStart as System.Windows. Forms.Button

              Which allows you to use the handles clause (and intellisense works well with
              it)...

              but enough about that..

              Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
              System.EventArg s) Handles btnStart.Click

              AddHandler objContainingEv ent.DisplayUnlo ck, AddressOf MyEventHandler

              End Sub


              Private Sub MyEventHandler( sender as object, e as System.EventArg s)

              me.txtScreenUnl ocked = Now().ToString( )


              End Sub

              "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
              news:8EBFB13A-DFF4-486C-AC61-30B7CFDC5C7C@mi crosoft.com...[color=blue]
              > Thanks, CJ -- but the little details still escape me. Let's say I have a
              > simple Winform app with a btnStart button:
              >
              > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
              > System.EventArg s) Handles btnStart.Click
              >
              > 'What goes in here? Let's say I want to write the current time
              > 'to Me.txtScreenUnl ocked when the DisplayUnlock event fires.
              >
              > End Sub
              >
              > "CJ Taylor" wrote:
              >[color=green]
              > > Event Sinks = Event Handlers [procedures]
              > >
              > > i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <- [Your event
              > > sink method]
              > >
              > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
              > > news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...[color=darkred]
              > > > Does anyone have an example of VB.Net code that uses the ISenslogon
              > > > interface? The documentation says to "subscribe to the SENS events[/color][/color][/color]
              that[color=blue][color=green][color=darkred]
              > > > interest you" and to "create a sink object". Whazza?
              > > >
              > > > I want to be notified when the display has been unlocked or the[/color]
              > > ScreenSaver[color=darkred]
              > > > has been stopped. If someone can get me started with a simple example[/color][/color][/color]
              in[color=blue][color=green]
              > > VB,[color=darkred]
              > > > that would be great.[/color]
              > >
              > >
              > >[/color][/color]


              Comment

              • Chris Dunaway

                #8
                Re: ISenslogon

                On Thu, 23 Sep 2004 06:09:03 -0700, Leigh Webber wrote:
                [color=blue]
                > Does anyone have an example of VB.Net code that uses the ISenslogon
                > interface? The documentation says to "subscribe to the SENS events that
                > interest you" and to "create a sink object". Whazza?
                >
                > I want to be notified when the display has been unlocked or the ScreenSaver
                > has been stopped. If someone can get me started with a simple example in VB,
                > that would be great.[/color]

                Well, you can set a reference to the SENS Event Notification System through
                the COM tab, but I looked at it and could not figure out how to use it. It
                has a number of interfaces but I couldn't determine if I needed to
                implement those interfaces or what.

                Perhaps someone who is familiar with it could look at them and make heads
                or tails out of it.

                --
                Chris

                dunawayc[AT]sbcglobal_lunch meat_[DOT]net

                To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
                replace certain words in my E-Mail address.

                Comment

                • Chris Dunaway

                  #9
                  Re: ISenslogon

                  On Thu, 23 Sep 2004 06:09:03 -0700, Leigh Webber wrote:
                  [color=blue]
                  > Does anyone have an example of VB.Net code that uses the ISenslogon
                  > interface? The documentation says to "subscribe to the SENS events that
                  > interest you" and to "create a sink object". Whazza?
                  >
                  > I want to be notified when the display has been unlocked or the ScreenSaver
                  > has been stopped. If someone can get me started with a simple example in VB,
                  > that would be great.[/color]

                  Well, you can set a reference to the SENS Event Notification System through
                  the COM tab, but I looked at it and could not figure out how to use it. It
                  has a number of interfaces but I couldn't determine if I needed to
                  implement those interfaces or what.

                  Perhaps someone who is familiar with it could look at them and make heads
                  or tails out of it.

                  --
                  Chris

                  dunawayc[AT]sbcglobal_lunch meat_[DOT]net

                  To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
                  replace certain words in my E-Mail address.

                  Comment

                  • Leigh Webber

                    #10
                    Re: ISenslogon

                    Thanks again, CJ. I think we're getting close. Here's my code:

                    [Reference added to COM: Sens Events TypeLibrary
                    (c:\windows\sys tem32\SENS.dll]

                    Public Class Form1
                    Inherits System.Windows. Forms.Form

                    [Windows Form Designer generated code]

                    Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                    System.EventArg s) _
                    Handles btnStart.Click
                    Dim loSENS As New SensEvents.SENS Class
                    AddHandler loSENS.DisplayU nlock, AddressOf MyScreenUnlocke dHandler
                    End Sub

                    Private Sub MyScreenUnlocke dHandler(ByVal UserName As String)
                    Me.txtScreenUnl ocked.Text = Now().ToString
                    End Sub
                    End Class


                    When I run the project and click the button, I get an error on the Dim
                    loSENS as New SensEvents.SENS Class line:

                    "An unhandled exception of type
                    'System.Runtime .InteropService s.COMException' occurred in UI.exe

                    Additional information: COM object with CLSID
                    {D597CAFE-5B9F-11D1-8DD2-00AA004ABD5E} is either not valid or not registered."

                    When I look in RegEdit, I see that the AppID for
                    c:\windows\syst em32\SENS.DLL is {D3938AB0-5B9D-11D1-8DD2-00AA004ABD5E}, while
                    the TypeLib value is {D597DEED-5B9F-11D1-8DD2-00AA004ABD5E}

                    Where does the D597CAFE part of the CLSID shown in the error message come
                    from? In the VB solution explorer, the SensEvents reference shows the correct
                    identity (D597DEED-...).

                    Dunno what to make of all this.

                    "CJ Taylor" wrote:
                    [color=blue]
                    > Hi Leigh,
                    >
                    > This is actually an event sink itself (note the handles clause, which can be
                    > used when a variable is declared WithEvents). If you look up in your
                    > Windows Forms Designer Generated Code Region you will see btnStart is
                    > declared
                    >
                    > Private WithEvents btnStart as System.Windows. Forms.Button
                    >
                    > Which allows you to use the handles clause (and intellisense works well with
                    > it)...
                    >
                    > but enough about that..
                    >
                    > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                    > System.EventArg s) Handles btnStart.Click
                    >
                    > AddHandler objContainingEv ent.DisplayUnlo ck, AddressOf MyEventHandler
                    >
                    > End Sub
                    >
                    >
                    > Private Sub MyEventHandler( sender as object, e as System.EventArg s)
                    >
                    > me.txtScreenUnl ocked = Now().ToString( )
                    >
                    >
                    > End Sub
                    >
                    > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
                    > news:8EBFB13A-DFF4-486C-AC61-30B7CFDC5C7C@mi crosoft.com...[color=green]
                    > > Thanks, CJ -- but the little details still escape me. Let's say I have a
                    > > simple Winform app with a btnStart button:
                    > >
                    > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                    > > System.EventArg s) Handles btnStart.Click
                    > >
                    > > 'What goes in here? Let's say I want to write the current time
                    > > 'to Me.txtScreenUnl ocked when the DisplayUnlock event fires.
                    > >
                    > > End Sub
                    > >
                    > > "CJ Taylor" wrote:
                    > >[color=darkred]
                    > > > Event Sinks = Event Handlers [procedures]
                    > > >
                    > > > i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <- [Your event
                    > > > sink method]
                    > > >
                    > > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
                    > > > news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...
                    > > > > Does anyone have an example of VB.Net code that uses the ISenslogon
                    > > > > interface? The documentation says to "subscribe to the SENS events[/color][/color]
                    > that[color=green][color=darkred]
                    > > > > interest you" and to "create a sink object". Whazza?
                    > > > >
                    > > > > I want to be notified when the display has been unlocked or the
                    > > > ScreenSaver
                    > > > > has been stopped. If someone can get me started with a simple example[/color][/color]
                    > in[color=green][color=darkred]
                    > > > VB,
                    > > > > that would be great.
                    > > >
                    > > >
                    > > >[/color][/color]
                    >
                    >
                    >[/color]

                    Comment

                    • CJ Taylor

                      #11
                      Re: ISenslogon

                      That certainly is interseting. I'm not too sure what to make of that. I
                      would say try readding the reference, but don't know if that will do any
                      good. It should have created the Interop to call the proper version... why
                      it only changed that first part is what I don't understand.

                      Hmm... perhaps someone else has seen this before... have you upgraded
                      libraries for SENS at all?


                      "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
                      news:3CBCF30E-2C00-43D7-AB8C-E1EE84440FF2@mi crosoft.com...[color=blue]
                      > Thanks again, CJ. I think we're getting close. Here's my code:
                      >
                      > [Reference added to COM: Sens Events TypeLibrary
                      > (c:\windows\sys tem32\SENS.dll]
                      >
                      > Public Class Form1
                      > Inherits System.Windows. Forms.Form
                      >
                      > [Windows Form Designer generated code]
                      >
                      > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                      > System.EventArg s) _
                      > Handles btnStart.Click
                      > Dim loSENS As New SensEvents.SENS Class
                      > AddHandler loSENS.DisplayU nlock, AddressOf MyScreenUnlocke dHandler
                      > End Sub
                      >
                      > Private Sub MyScreenUnlocke dHandler(ByVal UserName As String)
                      > Me.txtScreenUnl ocked.Text = Now().ToString
                      > End Sub
                      > End Class
                      >
                      >
                      > When I run the project and click the button, I get an error on the Dim
                      > loSENS as New SensEvents.SENS Class line:
                      >
                      > "An unhandled exception of type
                      > 'System.Runtime .InteropService s.COMException' occurred in UI.exe
                      >
                      > Additional information: COM object with CLSID
                      > {D597CAFE-5B9F-11D1-8DD2-00AA004ABD5E} is either not valid or not[/color]
                      registered."[color=blue]
                      >
                      > When I look in RegEdit, I see that the AppID for
                      > c:\windows\syst em32\SENS.DLL is {D3938AB0-5B9D-11D1-8DD2-00AA004ABD5E},[/color]
                      while[color=blue]
                      > the TypeLib value is {D597DEED-5B9F-11D1-8DD2-00AA004ABD5E}
                      >
                      > Where does the D597CAFE part of the CLSID shown in the error message come
                      > from? In the VB solution explorer, the SensEvents reference shows the[/color]
                      correct[color=blue]
                      > identity (D597DEED-...).
                      >
                      > Dunno what to make of all this.
                      >
                      > "CJ Taylor" wrote:
                      >[color=green]
                      > > Hi Leigh,
                      > >
                      > > This is actually an event sink itself (note the handles clause, which[/color][/color]
                      can be[color=blue][color=green]
                      > > used when a variable is declared WithEvents). If you look up in your
                      > > Windows Forms Designer Generated Code Region you will see btnStart is
                      > > declared
                      > >
                      > > Private WithEvents btnStart as System.Windows. Forms.Button
                      > >
                      > > Which allows you to use the handles clause (and intellisense works well[/color][/color]
                      with[color=blue][color=green]
                      > > it)...
                      > >
                      > > but enough about that..
                      > >
                      > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                      > > System.EventArg s) Handles btnStart.Click
                      > >
                      > > AddHandler objContainingEv ent.DisplayUnlo ck, AddressOf[/color][/color]
                      MyEventHandler[color=blue][color=green]
                      > >
                      > > End Sub
                      > >
                      > >
                      > > Private Sub MyEventHandler( sender as object, e as System.EventArg s)
                      > >
                      > > me.txtScreenUnl ocked = Now().ToString( )
                      > >
                      > >
                      > > End Sub
                      > >
                      > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
                      > > news:8EBFB13A-DFF4-486C-AC61-30B7CFDC5C7C@mi crosoft.com...[color=darkred]
                      > > > Thanks, CJ -- but the little details still escape me. Let's say I have[/color][/color][/color]
                      a[color=blue][color=green][color=darkred]
                      > > > simple Winform app with a btnStart button:
                      > > >
                      > > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                      > > > System.EventArg s) Handles btnStart.Click
                      > > >
                      > > > 'What goes in here? Let's say I want to write the current time
                      > > > 'to Me.txtScreenUnl ocked when the DisplayUnlock event fires.
                      > > >
                      > > > End Sub
                      > > >
                      > > > "CJ Taylor" wrote:
                      > > >
                      > > > > Event Sinks = Event Handlers [procedures]
                      > > > >
                      > > > > i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <- [Your[/color][/color][/color]
                      event[color=blue][color=green][color=darkred]
                      > > > > sink method]
                      > > > >
                      > > > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in[/color][/color][/color]
                      message[color=blue][color=green][color=darkred]
                      > > > > news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...
                      > > > > > Does anyone have an example of VB.Net code that uses the[/color][/color][/color]
                      ISenslogon[color=blue][color=green][color=darkred]
                      > > > > > interface? The documentation says to "subscribe to the SENS events[/color]
                      > > that[color=darkred]
                      > > > > > interest you" and to "create a sink object". Whazza?
                      > > > > >
                      > > > > > I want to be notified when the display has been unlocked or the
                      > > > > ScreenSaver
                      > > > > > has been stopped. If someone can get me started with a simple[/color][/color][/color]
                      example[color=blue][color=green]
                      > > in[color=darkred]
                      > > > > VB,
                      > > > > > that would be great.
                      > > > >
                      > > > >
                      > > > >[/color]
                      > >
                      > >
                      > >[/color][/color]


                      Comment

                      • Leigh Webber

                        #12
                        Re: ISenslogon

                        I haven't upgraded sens.dll, as far as I know. I don't even know how it got
                        on my sustem -- I suppost it came along with Internet Explorer 6, but that's
                        only a guess.

                        Perhaps someone else could copy and paste my code, try it out, and tell use
                        whether they get a different result? Or could anyone post some code that
                        actually does work?

                        "CJ Taylor" wrote:
                        [color=blue]
                        > That certainly is interseting. I'm not too sure what to make of that. I
                        > would say try readding the reference, but don't know if that will do any
                        > good. It should have created the Interop to call the proper version... why
                        > it only changed that first part is what I don't understand.
                        >
                        > Hmm... perhaps someone else has seen this before... have you upgraded
                        > libraries for SENS at all?
                        >
                        >
                        > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
                        > news:3CBCF30E-2C00-43D7-AB8C-E1EE84440FF2@mi crosoft.com...[color=green]
                        > > Thanks again, CJ. I think we're getting close. Here's my code:
                        > >
                        > > [Reference added to COM: Sens Events TypeLibrary
                        > > (c:\windows\sys tem32\SENS.dll]
                        > >
                        > > Public Class Form1
                        > > Inherits System.Windows. Forms.Form
                        > >
                        > > [Windows Form Designer generated code]
                        > >
                        > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                        > > System.EventArg s) _
                        > > Handles btnStart.Click
                        > > Dim loSENS As New SensEvents.SENS Class
                        > > AddHandler loSENS.DisplayU nlock, AddressOf MyScreenUnlocke dHandler
                        > > End Sub
                        > >
                        > > Private Sub MyScreenUnlocke dHandler(ByVal UserName As String)
                        > > Me.txtScreenUnl ocked.Text = Now().ToString
                        > > End Sub
                        > > End Class
                        > >
                        > >
                        > > When I run the project and click the button, I get an error on the Dim
                        > > loSENS as New SensEvents.SENS Class line:
                        > >
                        > > "An unhandled exception of type
                        > > 'System.Runtime .InteropService s.COMException' occurred in UI.exe
                        > >
                        > > Additional information: COM object with CLSID
                        > > {D597CAFE-5B9F-11D1-8DD2-00AA004ABD5E} is either not valid or not[/color]
                        > registered."[color=green]
                        > >
                        > > When I look in RegEdit, I see that the AppID for
                        > > c:\windows\syst em32\SENS.DLL is {D3938AB0-5B9D-11D1-8DD2-00AA004ABD5E},[/color]
                        > while[color=green]
                        > > the TypeLib value is {D597DEED-5B9F-11D1-8DD2-00AA004ABD5E}
                        > >
                        > > Where does the D597CAFE part of the CLSID shown in the error message come
                        > > from? In the VB solution explorer, the SensEvents reference shows the[/color]
                        > correct[color=green]
                        > > identity (D597DEED-...).
                        > >
                        > > Dunno what to make of all this.
                        > >
                        > > "CJ Taylor" wrote:
                        > >[color=darkred]
                        > > > Hi Leigh,
                        > > >
                        > > > This is actually an event sink itself (note the handles clause, which[/color][/color]
                        > can be[color=green][color=darkred]
                        > > > used when a variable is declared WithEvents). If you look up in your
                        > > > Windows Forms Designer Generated Code Region you will see btnStart is
                        > > > declared
                        > > >
                        > > > Private WithEvents btnStart as System.Windows. Forms.Button
                        > > >
                        > > > Which allows you to use the handles clause (and intellisense works well[/color][/color]
                        > with[color=green][color=darkred]
                        > > > it)...
                        > > >
                        > > > but enough about that..
                        > > >
                        > > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                        > > > System.EventArg s) Handles btnStart.Click
                        > > >
                        > > > AddHandler objContainingEv ent.DisplayUnlo ck, AddressOf[/color][/color]
                        > MyEventHandler[color=green][color=darkred]
                        > > >
                        > > > End Sub
                        > > >
                        > > >
                        > > > Private Sub MyEventHandler( sender as object, e as System.EventArg s)
                        > > >
                        > > > me.txtScreenUnl ocked = Now().ToString( )
                        > > >
                        > > >
                        > > > End Sub
                        > > >
                        > > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
                        > > > news:8EBFB13A-DFF4-486C-AC61-30B7CFDC5C7C@mi crosoft.com...
                        > > > > Thanks, CJ -- but the little details still escape me. Let's say I have[/color][/color]
                        > a[color=green][color=darkred]
                        > > > > simple Winform app with a btnStart button:
                        > > > >
                        > > > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                        > > > > System.EventArg s) Handles btnStart.Click
                        > > > >
                        > > > > 'What goes in here? Let's say I want to write the current time
                        > > > > 'to Me.txtScreenUnl ocked when the DisplayUnlock event fires.
                        > > > >
                        > > > > End Sub
                        > > > >
                        > > > > "CJ Taylor" wrote:
                        > > > >
                        > > > > > Event Sinks = Event Handlers [procedures]
                        > > > > >
                        > > > > > i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <- [Your[/color][/color]
                        > event[color=green][color=darkred]
                        > > > > > sink method]
                        > > > > >
                        > > > > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in[/color][/color]
                        > message[color=green][color=darkred]
                        > > > > > news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...
                        > > > > > > Does anyone have an example of VB.Net code that uses the[/color][/color]
                        > ISenslogon[color=green][color=darkred]
                        > > > > > > interface? The documentation says to "subscribe to the SENS events
                        > > > that
                        > > > > > > interest you" and to "create a sink object". Whazza?
                        > > > > > >
                        > > > > > > I want to be notified when the display has been unlocked or the
                        > > > > > ScreenSaver
                        > > > > > > has been stopped. If someone can get me started with a simple[/color][/color]
                        > example[color=green][color=darkred]
                        > > > in
                        > > > > > VB,
                        > > > > > > that would be great.
                        > > > > >
                        > > > > >
                        > > > > >
                        > > >
                        > > >
                        > > >[/color][/color]
                        >
                        >
                        >[/color]

                        Comment

                        • CJ Taylor

                          #13
                          Re: ISenslogon

                          Is this a Regular DLL or an ActiveX DLL?

                          "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
                          news:97FA81EB-22A2-4597-85CD-EAE62E8DC91C@mi crosoft.com...[color=blue]
                          > I haven't upgraded sens.dll, as far as I know. I don't even know how it[/color]
                          got[color=blue]
                          > on my sustem -- I suppost it came along with Internet Explorer 6, but[/color]
                          that's[color=blue]
                          > only a guess.
                          >
                          > Perhaps someone else could copy and paste my code, try it out, and tell[/color]
                          use[color=blue]
                          > whether they get a different result? Or could anyone post some code that
                          > actually does work?
                          >
                          > "CJ Taylor" wrote:
                          >[color=green]
                          > > That certainly is interseting. I'm not too sure what to make of that.[/color][/color]
                          I[color=blue][color=green]
                          > > would say try readding the reference, but don't know if that will do any
                          > > good. It should have created the Interop to call the proper version...[/color][/color]
                          why[color=blue][color=green]
                          > > it only changed that first part is what I don't understand.
                          > >
                          > > Hmm... perhaps someone else has seen this before... have you upgraded
                          > > libraries for SENS at all?
                          > >
                          > >
                          > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
                          > > news:3CBCF30E-2C00-43D7-AB8C-E1EE84440FF2@mi crosoft.com...[color=darkred]
                          > > > Thanks again, CJ. I think we're getting close. Here's my code:
                          > > >
                          > > > [Reference added to COM: Sens Events TypeLibrary
                          > > > (c:\windows\sys tem32\SENS.dll]
                          > > >
                          > > > Public Class Form1
                          > > > Inherits System.Windows. Forms.Form
                          > > >
                          > > > [Windows Form Designer generated code]
                          > > >
                          > > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e[/color][/color][/color]
                          As[color=blue][color=green][color=darkred]
                          > > > System.EventArg s) _
                          > > > Handles btnStart.Click
                          > > > Dim loSENS As New SensEvents.SENS Class
                          > > > AddHandler loSENS.DisplayU nlock, AddressOf[/color][/color][/color]
                          MyScreenUnlocke dHandler[color=blue][color=green][color=darkred]
                          > > > End Sub
                          > > >
                          > > > Private Sub MyScreenUnlocke dHandler(ByVal UserName As String)
                          > > > Me.txtScreenUnl ocked.Text = Now().ToString
                          > > > End Sub
                          > > > End Class
                          > > >
                          > > >
                          > > > When I run the project and click the button, I get an error on the Dim
                          > > > loSENS as New SensEvents.SENS Class line:
                          > > >
                          > > > "An unhandled exception of type
                          > > > 'System.Runtime .InteropService s.COMException' occurred in UI.exe
                          > > >
                          > > > Additional information: COM object with CLSID
                          > > > {D597CAFE-5B9F-11D1-8DD2-00AA004ABD5E} is either not valid or not[/color]
                          > > registered."[color=darkred]
                          > > >
                          > > > When I look in RegEdit, I see that the AppID for
                          > > > c:\windows\syst em32\SENS.DLL is[/color][/color][/color]
                          {D3938AB0-5B9D-11D1-8DD2-00AA004ABD5E},[color=blue][color=green]
                          > > while[color=darkred]
                          > > > the TypeLib value is {D597DEED-5B9F-11D1-8DD2-00AA004ABD5E}
                          > > >
                          > > > Where does the D597CAFE part of the CLSID shown in the error message[/color][/color][/color]
                          come[color=blue][color=green][color=darkred]
                          > > > from? In the VB solution explorer, the SensEvents reference shows the[/color]
                          > > correct[color=darkred]
                          > > > identity (D597DEED-...).
                          > > >
                          > > > Dunno what to make of all this.
                          > > >
                          > > > "CJ Taylor" wrote:
                          > > >
                          > > > > Hi Leigh,
                          > > > >
                          > > > > This is actually an event sink itself (note the handles clause,[/color][/color][/color]
                          which[color=blue][color=green]
                          > > can be[color=darkred]
                          > > > > used when a variable is declared WithEvents). If you look up in[/color][/color][/color]
                          your[color=blue][color=green][color=darkred]
                          > > > > Windows Forms Designer Generated Code Region you will see btnStart[/color][/color][/color]
                          is[color=blue][color=green][color=darkred]
                          > > > > declared
                          > > > >
                          > > > > Private WithEvents btnStart as System.Windows. Forms.Button
                          > > > >
                          > > > > Which allows you to use the handles clause (and intellisense works[/color][/color][/color]
                          well[color=blue][color=green]
                          > > with[color=darkred]
                          > > > > it)...
                          > > > >
                          > > > > but enough about that..
                          > > > >
                          > > > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                          > > > > System.EventArg s) Handles btnStart.Click
                          > > > >
                          > > > > AddHandler objContainingEv ent.DisplayUnlo ck, AddressOf[/color]
                          > > MyEventHandler[color=darkred]
                          > > > >
                          > > > > End Sub
                          > > > >
                          > > > >
                          > > > > Private Sub MyEventHandler( sender as object, e as System.EventArg s)
                          > > > >
                          > > > > me.txtScreenUnl ocked = Now().ToString( )
                          > > > >
                          > > > >
                          > > > > End Sub
                          > > > >
                          > > > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in[/color][/color][/color]
                          message[color=blue][color=green][color=darkred]
                          > > > > news:8EBFB13A-DFF4-486C-AC61-30B7CFDC5C7C@mi crosoft.com...
                          > > > > > Thanks, CJ -- but the little details still escape me. Let's say I[/color][/color][/color]
                          have[color=blue][color=green]
                          > > a[color=darkred]
                          > > > > > simple Winform app with a btnStart button:
                          > > > > >
                          > > > > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e[/color][/color][/color]
                          As[color=blue][color=green][color=darkred]
                          > > > > > System.EventArg s) Handles btnStart.Click
                          > > > > >
                          > > > > > 'What goes in here? Let's say I want to write the current time
                          > > > > > 'to Me.txtScreenUnl ocked when the DisplayUnlock event fires.
                          > > > > >
                          > > > > > End Sub
                          > > > > >
                          > > > > > "CJ Taylor" wrote:
                          > > > > >
                          > > > > > > Event Sinks = Event Handlers [procedures]
                          > > > > > >
                          > > > > > > i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <-[/color][/color][/color]
                          [Your[color=blue][color=green]
                          > > event[color=darkred]
                          > > > > > > sink method]
                          > > > > > >
                          > > > > > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in[/color]
                          > > message[color=darkred]
                          > > > > > > news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...
                          > > > > > > > Does anyone have an example of VB.Net code that uses the[/color]
                          > > ISenslogon[color=darkred]
                          > > > > > > > interface? The documentation says to "subscribe to the SENS[/color][/color][/color]
                          events[color=blue][color=green][color=darkred]
                          > > > > that
                          > > > > > > > interest you" and to "create a sink object". Whazza?
                          > > > > > > >
                          > > > > > > > I want to be notified when the display has been unlocked or[/color][/color][/color]
                          the[color=blue][color=green][color=darkred]
                          > > > > > > ScreenSaver
                          > > > > > > > has been stopped. If someone can get me started with a simple[/color]
                          > > example[color=darkred]
                          > > > > in
                          > > > > > > VB,
                          > > > > > > > that would be great.
                          > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > >
                          > > > >
                          > > > >[/color]
                          > >
                          > >
                          > >[/color][/color]


                          Comment

                          • Leigh Webber

                            #14
                            Re: ISenslogon

                            I think it's a special kind of DLL. I have been poking around the
                            documentation for Loosely Coupled Events, and it looks like you subscribe to
                            SENS events using the Component Services snap-in. There's a C# example in the
                            LCE docs that I can make work, but it involves subscribing to a custom
                            publisher you create in code. My current stumbling block is that in Component
                            Services I can't find the SENS publisher to subscribe to!

                            Sure wish there was someone at MS who could show a sample of subscribing to
                            SENS events.

                            "CJ Taylor" wrote:
                            [color=blue]
                            > Is this a Regular DLL or an ActiveX DLL?
                            >
                            > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
                            > news:97FA81EB-22A2-4597-85CD-EAE62E8DC91C@mi crosoft.com...[color=green]
                            > > I haven't upgraded sens.dll, as far as I know. I don't even know how it[/color]
                            > got[color=green]
                            > > on my sustem -- I suppost it came along with Internet Explorer 6, but[/color]
                            > that's[color=green]
                            > > only a guess.
                            > >
                            > > Perhaps someone else could copy and paste my code, try it out, and tell[/color]
                            > use[color=green]
                            > > whether they get a different result? Or could anyone post some code that
                            > > actually does work?
                            > >
                            > > "CJ Taylor" wrote:
                            > >[color=darkred]
                            > > > That certainly is interseting. I'm not too sure what to make of that.[/color][/color]
                            > I[color=green][color=darkred]
                            > > > would say try readding the reference, but don't know if that will do any
                            > > > good. It should have created the Interop to call the proper version...[/color][/color]
                            > why[color=green][color=darkred]
                            > > > it only changed that first part is what I don't understand.
                            > > >
                            > > > Hmm... perhaps someone else has seen this before... have you upgraded
                            > > > libraries for SENS at all?
                            > > >
                            > > >
                            > > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in message
                            > > > news:3CBCF30E-2C00-43D7-AB8C-E1EE84440FF2@mi crosoft.com...
                            > > > > Thanks again, CJ. I think we're getting close. Here's my code:
                            > > > >
                            > > > > [Reference added to COM: Sens Events TypeLibrary
                            > > > > (c:\windows\sys tem32\SENS.dll]
                            > > > >
                            > > > > Public Class Form1
                            > > > > Inherits System.Windows. Forms.Form
                            > > > >
                            > > > > [Windows Form Designer generated code]
                            > > > >
                            > > > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e[/color][/color]
                            > As[color=green][color=darkred]
                            > > > > System.EventArg s) _
                            > > > > Handles btnStart.Click
                            > > > > Dim loSENS As New SensEvents.SENS Class
                            > > > > AddHandler loSENS.DisplayU nlock, AddressOf[/color][/color]
                            > MyScreenUnlocke dHandler[color=green][color=darkred]
                            > > > > End Sub
                            > > > >
                            > > > > Private Sub MyScreenUnlocke dHandler(ByVal UserName As String)
                            > > > > Me.txtScreenUnl ocked.Text = Now().ToString
                            > > > > End Sub
                            > > > > End Class
                            > > > >
                            > > > >
                            > > > > When I run the project and click the button, I get an error on the Dim
                            > > > > loSENS as New SensEvents.SENS Class line:
                            > > > >
                            > > > > "An unhandled exception of type
                            > > > > 'System.Runtime .InteropService s.COMException' occurred in UI.exe
                            > > > >
                            > > > > Additional information: COM object with CLSID
                            > > > > {D597CAFE-5B9F-11D1-8DD2-00AA004ABD5E} is either not valid or not
                            > > > registered."
                            > > > >
                            > > > > When I look in RegEdit, I see that the AppID for
                            > > > > c:\windows\syst em32\SENS.DLL is[/color][/color]
                            > {D3938AB0-5B9D-11D1-8DD2-00AA004ABD5E},[color=green][color=darkred]
                            > > > while
                            > > > > the TypeLib value is {D597DEED-5B9F-11D1-8DD2-00AA004ABD5E}
                            > > > >
                            > > > > Where does the D597CAFE part of the CLSID shown in the error message[/color][/color]
                            > come[color=green][color=darkred]
                            > > > > from? In the VB solution explorer, the SensEvents reference shows the
                            > > > correct
                            > > > > identity (D597DEED-...).
                            > > > >
                            > > > > Dunno what to make of all this.
                            > > > >
                            > > > > "CJ Taylor" wrote:
                            > > > >
                            > > > > > Hi Leigh,
                            > > > > >
                            > > > > > This is actually an event sink itself (note the handles clause,[/color][/color]
                            > which[color=green][color=darkred]
                            > > > can be
                            > > > > > used when a variable is declared WithEvents). If you look up in[/color][/color]
                            > your[color=green][color=darkred]
                            > > > > > Windows Forms Designer Generated Code Region you will see btnStart[/color][/color]
                            > is[color=green][color=darkred]
                            > > > > > declared
                            > > > > >
                            > > > > > Private WithEvents btnStart as System.Windows. Forms.Button
                            > > > > >
                            > > > > > Which allows you to use the handles clause (and intellisense works[/color][/color]
                            > well[color=green][color=darkred]
                            > > > with
                            > > > > > it)...
                            > > > > >
                            > > > > > but enough about that..
                            > > > > >
                            > > > > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e As
                            > > > > > System.EventArg s) Handles btnStart.Click
                            > > > > >
                            > > > > > AddHandler objContainingEv ent.DisplayUnlo ck, AddressOf
                            > > > MyEventHandler
                            > > > > >
                            > > > > > End Sub
                            > > > > >
                            > > > > >
                            > > > > > Private Sub MyEventHandler( sender as object, e as System.EventArg s)
                            > > > > >
                            > > > > > me.txtScreenUnl ocked = Now().ToString( )
                            > > > > >
                            > > > > >
                            > > > > > End Sub
                            > > > > >
                            > > > > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in[/color][/color]
                            > message[color=green][color=darkred]
                            > > > > > news:8EBFB13A-DFF4-486C-AC61-30B7CFDC5C7C@mi crosoft.com...
                            > > > > > > Thanks, CJ -- but the little details still escape me. Let's say I[/color][/color]
                            > have[color=green][color=darkred]
                            > > > a
                            > > > > > > simple Winform app with a btnStart button:
                            > > > > > >
                            > > > > > > Private Sub btnStart_Click( ByVal sender As System.Object, ByVal e[/color][/color]
                            > As[color=green][color=darkred]
                            > > > > > > System.EventArg s) Handles btnStart.Click
                            > > > > > >
                            > > > > > > 'What goes in here? Let's say I want to write the current time
                            > > > > > > 'to Me.txtScreenUnl ocked when the DisplayUnlock event fires.
                            > > > > > >
                            > > > > > > End Sub
                            > > > > > >
                            > > > > > > "CJ Taylor" wrote:
                            > > > > > >
                            > > > > > > > Event Sinks = Event Handlers [procedures]
                            > > > > > > >
                            > > > > > > > i.e. AddHandler MyClass.MyEvent , AddressOF MyEventHandler <-[/color][/color]
                            > [Your[color=green][color=darkred]
                            > > > event
                            > > > > > > > sink method]
                            > > > > > > >
                            > > > > > > > "Leigh Webber" <LeighWebber@di scussions.micro soft.com> wrote in
                            > > > message
                            > > > > > > > news:3780D89A-055C-4E39-9028-B3DC5B4A0913@mi crosoft.com...
                            > > > > > > > > Does anyone have an example of VB.Net code that uses the
                            > > > ISenslogon
                            > > > > > > > > interface? The documentation says to "subscribe to the SENS[/color][/color]
                            > events[color=green][color=darkred]
                            > > > > > that
                            > > > > > > > > interest you" and to "create a sink object". Whazza?
                            > > > > > > > >
                            > > > > > > > > I want to be notified when the display has been unlocked or[/color][/color]
                            > the[color=green][color=darkred]
                            > > > > > > > ScreenSaver
                            > > > > > > > > has been stopped. If someone can get me started with a simple
                            > > > example
                            > > > > > in
                            > > > > > > > VB,
                            > > > > > > > > that would be great.
                            > > > > > > >
                            > > > > > > >
                            > > > > > > >
                            > > > > >
                            > > > > >
                            > > > > >
                            > > >
                            > > >
                            > > >[/color][/color]
                            >
                            >
                            >[/color]

                            Comment

                            Working...