The ISensNetwork interface handles network events fired by the System Event Notification Service (SENS).
When To Implement
Implement this interface on your sink object if you subscribe to any of the SENS network events. Each event corresponds to a method in this interface. This interface is an outgoing interface defined by SENS and implemented by the subscriber application as a dispatch interface.
When To Use
SENS and the COM Event System call the ISensNetwork methods on your sink object to fire the corresponding event.
Methods in Vtable Order
The ISensNetwork interface inherits the methods of the standard COM interface IUnknown.
In addition, ISensNetwork defines the following methods.
Method Description
GetTypeInfoCount Retrieves the number of type descriptions.
GetTypeInfo Retrieves a description of the object's programmable interface.
GetIDsOfNames Maps name of method or property to DISPID.
Invoke Calls one of the object's methods, or gets/sets one of its properties.
ConnectionMade Specified connection has been established.
ConnectionMadeNoQOCInfo Specified connection has been established with no Quality of Connection information available.
ConnectionLost Specified connection has been dropped.
DestinationReachable Specified connection can be reached.
DestinationReachableNoQOCInfo Specified connection can be reached with no Quality of Connection information.
Requirements
Client: Included in Windows XP, Windows 2000 Professional, and Windows Me.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Internet Explorer 5 or later on Windows NT 4.0 and Windows 95/98.
Header: Declared in Sensevts.h.
Library: Use Sensevts.tlb.
procedure TForm1.Button1Click(Sender: TObject);
begin
//SM_NETWORK标志值为1,则表示计算机连上了网络;值为0,则表示计算机沿未连接网络
if GetSystemMetrics(SM_NETWORK) AND $01=$01 then
showmessage('连上了网络')
else
showmessage('尚未连上网络');
end;