473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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.
Nov 21 '05 #1
13 3651
Event Sinks = Event Handlers [procedures]

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

"Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
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.

Nov 21 '05 #2
Event Sinks = Event Handlers [procedures]

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

"Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
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.

Nov 21 '05 #3
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" wrote:
Event Sinks = Event Handlers [procedures]

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

"Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
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.


Nov 21 '05 #4
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" wrote:
Event Sinks = Event Handlers [procedures]

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

"Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
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.


Nov 21 '05 #5
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" <Le*********@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
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" wrote:
Event Sinks = Event Handlers [procedures]

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

"Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
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.


Nov 21 '05 #6
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" <Le*********@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
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" wrote:
Event Sinks = Event Handlers [procedures]

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

"Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
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.


Nov 21 '05 #7
On Thu, 23 Sep 2004 06:09:03 -0700, Leigh Webber wrote:
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.
Nov 21 '05 #8
On Thu, 23 Sep 2004 06:09:03 -0700, Leigh Webber wrote:
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.
Nov 21 '05 #9
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" wrote:
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" <Le*********@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
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" wrote:
Event Sinks = Event Handlers [procedures]

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

"Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
> 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.


Nov 21 '05 #10
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" <Le*********@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
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" wrote:
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" <Le*********@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
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" wrote:

> Event Sinks = Event Handlers [procedures]
>
> i.e. AddHandler MyClass.MyEvent, AddressOF MyEventHandler <- [Your event > sink method]
>
> "Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message > news:37**********************************@microsof t.com...
> > 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.
>
>
>


Nov 21 '05 #11
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:
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" <Le*********@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
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" wrote:
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" <Le*********@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
> 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" wrote:
>
> > Event Sinks = Event Handlers [procedures]
> >
> > i.e. AddHandler MyClass.MyEvent, AddressOF MyEventHandler <- [Your event > > sink method]
> >
> > "Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message > > news:37**********************************@microsof t.com...
> > > 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.
> >
> >
> >


Nov 21 '05 #12
Is this a Regular DLL or an ActiveX DLL?

"Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message
news:97**********************************@microsof t.com...
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:
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" <Le*********@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
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" wrote:

> 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" <Le*********@discussions.microsoft.com> wrote in
message > news:8E**********************************@microsof t.com...
> > 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" wrote:
> >
> > > Event Sinks = Event Handlers [procedures]
> > >
> > > i.e. AddHandler MyClass.MyEvent, AddressOF MyEventHandler <- [Your event
> > > sink method]
> > >
> > > "Leigh Webber" <Le*********@discussions.microsoft.com> wrote in

message
> > > news:37**********************************@microsof t.com...
> > > > 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.
> > >
> > >
> > >
>
>
>


Nov 21 '05 #13
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:
Is this a Regular DLL or an ActiveX DLL?

"Leigh Webber" <Le*********@discussions.microsoft.com> wrote in message
news:97**********************************@microsof t.com...
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:
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" <Le*********@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
> 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" wrote:
>
> > 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" <Le*********@discussions.microsoft.com> wrote in message > > news:8E**********************************@microsof t.com...
> > > 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" wrote:
> > >
> > > > Event Sinks = Event Handlers [procedures]
> > > >
> > > > i.e. AddHandler MyClass.MyEvent, AddressOF MyEventHandler <- [Your event
> > > > sink method]
> > > >
> > > > "Leigh Webber" <Le*********@discussions.microsoft.com> wrote in
message
> > > > news:37**********************************@microsof t.com...
> > > > > 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.
> > > >
> > > >
> > > >
> >
> >
> >


Nov 21 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: priyamjm | last post by:
I would like to write a Windows Service app that will be notified when an interactive user logs on/off the local computer. Thanks in advance Priyakant
0
by: Leigh Webber | last post by:
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? ...
0
by: Skok Tone | last post by:
Hello, well, after few hours of pulling hair from head I decided to ask specialists. I'm trying to implement service which inherits SensEvents.ISensLogon to get notified when user logon and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.