mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: UIXControls.OSInfo
|
|
// Assembly: UIXControls, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
|
// MVID: 78800EA5-2757-404C-BA30-C33FCFC2852A
|
|
// Assembly location: C:\Program Files\Zune\UIXControls.dll
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace UIXControls
|
|
{
|
|
public static class OSInfo
|
|
{
|
|
private const uint SPI_GETKEYBOARDSPEED = 10;
|
|
private const uint SPI_GETKEYBOARDDELAY = 22;
|
|
private static int s_defaultKeyDelay = GetDefaultKeyDelay();
|
|
private static int s_defaultKeyRepeat = GetDefaultKeyRepeat();
|
|
|
|
public static bool IsCapsLockOn() => (GetKeyState(20U) & 1) != 0;
|
|
|
|
[DllImport("user32.dll")]
|
|
private static extern ushort GetKeyState(uint nVirtKey);
|
|
|
|
public static int DefaultKeyDelay => s_defaultKeyDelay;
|
|
|
|
public static int DefaultKeyRepeat => s_defaultKeyRepeat;
|
|
|
|
private static int GetDefaultKeyDelay()
|
|
{
|
|
int pParam;
|
|
if (!SystemParametersInfo(22U, 0U, out pParam, 0))
|
|
pParam = 1;
|
|
return (pParam + 1) * 250;
|
|
}
|
|
|
|
private static int GetDefaultKeyRepeat()
|
|
{
|
|
int pParam;
|
|
if (!SystemParametersInfo(10U, 0U, out pParam, 0))
|
|
pParam = 1;
|
|
return 31000 / (62 + 28 * pParam);
|
|
}
|
|
|
|
[DllImport("user32.dll", SetLastError = true)]
|
|
private static extern bool SystemParametersInfo(
|
|
uint uiAction,
|
|
uint uiParam,
|
|
out int pParam,
|
|
int nWinIni);
|
|
}
|
|
}
|