ISenslogon

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
Event Sinks = Event Handlers [procedures]

i.e. AddHandler MyClass.MyEvent, AddressOF MyEventHandler <- [Your event
sink method]
 
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.EventArgs) Handles btnStart.Click

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

End Sub

CJ Taylor said:
Event Sinks = Event Handlers [procedures]

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

Leigh Webber said:
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.
 
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.EventArgs) Handles btnStart.Click

AddHandler objContainingEvent.DisplayUnlock, AddressOf MyEventHandler

End Sub


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

me.txtScreenUnlocked = Now().ToString()


End Sub

Leigh Webber said:
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.EventArgs) Handles btnStart.Click

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

End Sub

CJ Taylor said:
Event Sinks = Event Handlers [procedures]

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

Leigh Webber said:
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.
 
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.

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_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
Thanks again, CJ. I think we're getting close. Here's my code:

[Reference added to COM: Sens Events TypeLibrary
(c:\windows\system32\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.EventArgs) _
Handles btnStart.Click
Dim loSENS As New SensEvents.SENSClass
AddHandler loSENS.DisplayUnlock, AddressOf MyScreenUnlockedHandler
End Sub

Private Sub MyScreenUnlockedHandler(ByVal UserName As String)
Me.txtScreenUnlocked.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.SENSClass line:

"An unhandled exception of type
'System.Runtime.InteropServices.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\system32\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 said:
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.EventArgs) Handles btnStart.Click

AddHandler objContainingEvent.DisplayUnlock, AddressOf MyEventHandler

End Sub


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

me.txtScreenUnlocked = Now().ToString()


End Sub

Leigh Webber said:
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.EventArgs) Handles btnStart.Click

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

End Sub

CJ Taylor said:
Event Sinks = Event Handlers [procedures]

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

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.
 
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 said:
Thanks again, CJ. I think we're getting close. Here's my code:

[Reference added to COM: Sens Events TypeLibrary
(c:\windows\system32\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.EventArgs) _
Handles btnStart.Click
Dim loSENS As New SensEvents.SENSClass
AddHandler loSENS.DisplayUnlock, AddressOf MyScreenUnlockedHandler
End Sub

Private Sub MyScreenUnlockedHandler(ByVal UserName As String)
Me.txtScreenUnlocked.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.SENSClass line:

"An unhandled exception of type
'System.Runtime.InteropServices.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\system32\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 said:
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.EventArgs) Handles btnStart.Click

AddHandler objContainingEvent.DisplayUnlock, AddressOf MyEventHandler

End Sub


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

me.txtScreenUnlocked = Now().ToString()


End Sub

Leigh Webber said:
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.EventArgs) Handles btnStart.Click

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

End Sub

:

Event Sinks = Event Handlers [procedures]

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

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.
 
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 said:
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 said:
Thanks again, CJ. I think we're getting close. Here's my code:

[Reference added to COM: Sens Events TypeLibrary
(c:\windows\system32\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.EventArgs) _
Handles btnStart.Click
Dim loSENS As New SensEvents.SENSClass
AddHandler loSENS.DisplayUnlock, AddressOf MyScreenUnlockedHandler
End Sub

Private Sub MyScreenUnlockedHandler(ByVal UserName As String)
Me.txtScreenUnlocked.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.SENSClass line:

"An unhandled exception of type
'System.Runtime.InteropServices.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\system32\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 said:
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.EventArgs) Handles btnStart.Click

AddHandler objContainingEvent.DisplayUnlock, AddressOf MyEventHandler

End Sub


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

me.txtScreenUnlocked = Now().ToString()


End Sub

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.EventArgs) Handles btnStart.Click

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

End Sub

:

Event Sinks = Event Handlers [procedures]

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

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.
 
Is this a Regular DLL or an ActiveX DLL?

Leigh Webber said:
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 said:
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 said:
Thanks again, CJ. I think we're getting close. Here's my code:

[Reference added to COM: Sens Events TypeLibrary
(c:\windows\system32\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.EventArgs) _
Handles btnStart.Click
Dim loSENS As New SensEvents.SENSClass
AddHandler loSENS.DisplayUnlock, AddressOf MyScreenUnlockedHandler
End Sub

Private Sub MyScreenUnlockedHandler(ByVal UserName As String)
Me.txtScreenUnlocked.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.SENSClass line:

"An unhandled exception of type
'System.Runtime.InteropServices.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\system32\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.

:

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.EventArgs) Handles btnStart.Click

AddHandler objContainingEvent.DisplayUnlock, AddressOf MyEventHandler

End Sub


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

me.txtScreenUnlocked = Now().ToString()


End Sub

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.EventArgs) Handles btnStart.Click

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

End Sub

:

Event Sinks = Event Handlers [procedures]

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

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.
 
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 said:
Is this a Regular DLL or an ActiveX DLL?

Leigh Webber said:
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 said:
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?


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

[Reference added to COM: Sens Events TypeLibrary
(c:\windows\system32\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.EventArgs) _
Handles btnStart.Click
Dim loSENS As New SensEvents.SENSClass
AddHandler loSENS.DisplayUnlock, AddressOf MyScreenUnlockedHandler
End Sub

Private Sub MyScreenUnlockedHandler(ByVal UserName As String)
Me.txtScreenUnlocked.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.SENSClass line:

"An unhandled exception of type
'System.Runtime.InteropServices.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\system32\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.

:

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.EventArgs) Handles btnStart.Click

AddHandler objContainingEvent.DisplayUnlock, AddressOf
MyEventHandler

End Sub


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

me.txtScreenUnlocked = Now().ToString()


End Sub

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.EventArgs) Handles btnStart.Click

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

End Sub

:

Event Sinks = Event Handlers [procedures]

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

message
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top