@msdn=http://search.microsoft.com/search/results.aspx?qu=NtQueryWnfStateData @pinvoke=http://pinvoke.net/NtQueryWnfStateData.htm Summary: Returns the state of the Focus Assist feature in Windows 10 Build >= 17083 !!!!C# Signature: [DllImport("ntdll.dll", SetLastError=true)] private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize); !!!!VB Signature: Declare Function NtQueryWnfStateData Lib "ntdll.dll" (TODO) As TODO !!!!User-Defined Types: [StructLayout(LayoutKind.Sequential)] public struct WNF_TYPE_ID { public Guid TypeId; } [StructLayout(LayoutKind.Sequential)] public struct WNF_STATE_NAME { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] Data; public WNF_STATE_NAME(uint Data1, uint Data2) : this() { uint[] newData = new uint[2]; newData[0] = Data1; newData[1] = Data2; Data = newData; } } public enum FocusAssistResult { NOT_SUPPORTED = -2, FAILED = -1, OFF = 0, PRIORITY_ONLY = 1, ALARMS_ONLY = 2 }; !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: This function replaces Quiet Hours in Windows 10 build >= 17083. !!!!Tips & Tricks: Please add some! !!!!Sample Code: private FocusAssistResult GetUserNotificationState() { // Focus Assist: Windows 10 build >= 17083 WNF_STATE_NAME WNF_SHEL_QUIETHOURS_ACTIVE_PROFILE_CHANGED = new WNF_STATE_NAME(0xA3BF1C75, 0xD83063E); uint nBufferSize = (uint)Marshal.SizeOf(typeof(IntPtr)); IntPtr pStateName = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(WNF_STATE_NAME))); Marshal.StructureToPtr(WNF_SHEL_QUIETHOURS_ACTIVE_PROFILE_CHANGED, pStateName, false); bool success = NtQueryWnfStateData(pStateName, IntPtr.Zero, IntPtr.Zero, out uint nChangeStamp, out IntPtr pBuffer, ref nBufferSize) == 0; Marshal.FreeHGlobal(pStateName); if (success) { return (FocusAssistResult)pBuffer; } return FocusAssistResult.FAILED; } Documentation: NtQueryWnfStateData@msdn on MSDN
Edit ntdll.NtQueryWnfS...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.