查了很多资料涉及到Notification Broker的都只有触发一种状态的代码,但是为了一个功能改进,我需要一种能获取多种电话状态(呼出、呼入、通话中……)的方法,同时由于程序是需要主动触发的,所以用RegistryNotifyApp做主动Broker,查了MSDN却发现没有对RegistryNotifyApp如何在多种事件中启动做出过多说明,就继续翻其他MSDN,终于看到在NOTIFICATIONCONDITION的解释里有这含义模糊的两行文字:
dwMask
Applies only to DWORD values. This mask is applied to the changed registry value before comparison. By specifying a bit mask, the Notifications Broker notifies the clients only when specific bits in the registry value changes.
This mask is not applied to TargetValue. If dwMask is 0, TargetValue is treated as a string (type REG_SZ), otherwise it is treated as type REG_DWORD.
TargetValue
If the changed value is type REG_SZ, then comparison is done between psz and the changed value. If the changed value is type REG_DWORD, then dwMask is applied to the changed value and then the result is compared to dw. If the changed value is neither REG_SZ nor REG_DWORD, then notification is sent without any comparison. You must set dwMask to -1 to test against the whole doubleword.