How to receive event when network is connected and also when user logs in

前端 未结 6 1589
再見小時候
再見小時候 2021-02-06 02:32

I have a service that runs and I\'d like to receive notification when:

a) the network is connected.

b) when a user logs in to the machine.

How can I do

6条回答
  •  自闭症患者
    2021-02-06 03:11

    You can't do b) with .NET 2.0. For XP and before, you need to create a GINA replacement, which is an unmanaged DLL which exports a specified set of functions.

    In Vista, there is a different COM-based model which you have to use which you might be able to use .NET 2.0 for, but I wouldn't be surprised if you can't.

    What I would do is have your GINA replacement (or the equivalent on Vista) send a signal of some kind to your service.

    For a) these two links should be able to help:

    Network Awareness in Windows XP

    http://msdn.microsoft.com/en-us/library/ms700657(VS.85).aspx

    Network Awareness on Windows Vista

    http://msdn.microsoft.com/en-us/library/ms697388(VS.85).aspx

提交回复
热议问题