In my project, I want to catch some named event from the system, like "IDH/Presence" or "IDH/AmbiantLi开发者_运维问答ght".
How can I do that ?
Edit: Is that possible with the EventWaitHandle class of the Smart Device Framework ?
Thanks.
The CF itself doesn't provide the ability to use named system events.
The SDF's EventWaitHandle does provide the capability by using either of the constructors that allow for the name parameter.
The other option is to P/Invoke CreateEvent and WaitForSingle/WaitForMultipleObjects.
I am not familiar with the functionality you refer to in the SDF (ctacke will probably answer that). But, to wait on a named event handle you simple call CreateEvent
with the name and wait on the handle that is returned.
Be aware that in case the event is auto reset, only one WaitForSingleObject
call will catch it and then it will be reset so if other threads are waiting on the same handle you might not catch the event.
精彩评论