使用WMI

1.使用WMI,去查詢Win32_Battery類型的Battery_Status屬性

引用System.Management.dll

查詢語句:(注意:__InstanceModificationEvent有兩個下劃線,可把我坑了/(ㄒoㄒ)/~~

var qCreate = new WqlEventQuery("__InstanceModificationEvent",TimeSpan.FromSeconds(3), "TargetInstance ISA 'Win32_Battery'");


後續有待更新......


備考:

Win32_Battery

地址:https://msdn.microsoft.com/en-us/library/windows/desktop/aa394074(v=vs.85).aspx#properties

using “within” in a WMI event query

https://blogs.msdn.microsoft.com/wmi/2009/12/28/using-within-in-a-wmi-event-query/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章