IMatchEventSource::Start method

The Start method causes the source to start sending MatchFound and MatchLost events to the client.

Syntax

HRESULT Start();

Parameters

This method has no parameters.

Return value

Start returns a standard HRESULT value.

Remarks

The Start method blocks until existing matches have been sent. If this method is called a second time, Start is a No-Op and returns S_FALSE.

In the C++ language, to receive event callbacks from the IMatchEventSource object, you must advise the connection point (this technique is beyond the scope of this topic). The following code examples show the equivalent in other languages.

VBScript

' Request match callbacks for devices with a certain compatible ID
'
Set WDTF = WScript.CreateObject("WDTF.WDTF")
Set EventSource = 
    WDTF.DeviceDepot.GetMatchEventSource("CompatIDs='PCI\CC_0200'")
 
 ConnectObject("Event_", EventSource);
 
 EventSource.Start()
 
For i = 0 To 10
 WDTF.DeviceDepot.UpdateAndReportMatches()
 WScript.Sleep(10000)
Next 
 
Function Event_MatchFound(Target, EventSource)
 
 WScript.Echo "MatchFound: " & Target.GetValue("DisplayName")
 
End Function
 
Function Event_MatchLost(Target, EventSource)
 
 WScript.Echo "MatchLost: " & Target.GetValue("DisplayName")
 
End Function

JScript

//
// Include Common.js. See SampleScripts for more details
//
...
//
// Request match callbacks for devices with a certain compatible ID
//
 var WDTF = new JScript_WDTF();
 var EventSource = 
     WDTF.DeviceDepot.GetMatchEventSource("CompatIDs='PCI\CC_0200'");
 
 EventSource.Start(MatchFound, MatchLost, MatchInitial)
 
for(var i = 0; i <= 10; i++)
{
 WDTF.DeviceDepot.UpdateAndReportMatches();
 WScript.Sleep(10000);
} 
 
function MatchInitial(Target, EventSource)
{
 WScript.Echo "MatchInitial: " & Target.GetValue("DisplayName") 
}
function MatchFound(Target, EventSource)
{
 WScript.Echo "MatchFound: " & Target.GetValue("DisplayName") 
}
function MatchLost(Target, EventSource)
{
 WScript.Echo "MatchLost: " & Target.GetValue("DisplayName") 
}

See also

IMatchEventSource

IMatchEventSource::MatchFound

IMatchEventSource::MatchLost

 

 

Send comments about this topic to Microsoft

Build date: 3/12/2012