CarotDav_decompile/CarotDAV/Misc.cs

54 lines
1.4 KiB
C#
Raw Normal View History

// Decompiled with JetBrains decompiler
// Type: CarotDAV.Misc
// Assembly: CarotDAV, Version=1.13.2.18337, Culture=neutral, PublicKeyToken=null
// MVID: C31F2651-A4A8-4D09-916A-8C6106F5E7C8
// Assembly location: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\CarotDAV.exe
using System;
using System.Runtime.InteropServices;
namespace CarotDAV
{
public sealed class Misc
{
[DllImport("user32.dll")]
public static extern bool GetLastInputInfo(ref Misc.LASTINPUTINFO plii);
public static uint GetIdleTime()
{
Misc.LASTINPUTINFO plii = new Misc.LASTINPUTINFO();
plii.cbSize = Marshal.SizeOf((object) plii);
Misc.GetLastInputInfo(ref plii);
int tickCount = Environment.TickCount;
if (tickCount >= plii.dwTime)
return checked ((uint) ((long) tickCount - (long) plii.dwTime));
return checked ((uint) ((long) tickCount - (long) int.MinValue + (long) int.MaxValue + 1L - (long) plii.dwTime));
}
public struct LASTINPUTINFO
{
[MarshalAs(UnmanagedType.U4)]
public int cbSize;
[MarshalAs(UnmanagedType.U4)]
public int dwTime;
}
public struct WINDOWPOS
{
public IntPtr hwnd;
public IntPtr hwndInsertAfter;
public int x;
public int y;
public int cx;
public int cy;
public int flags;
}
public enum WindowMessageType
{
WM_WINDOWPOSCHANGING = 70,
WM_WINDOWPOSCHANGED = 71,
}
}
}