Dear Sir,
I have an error "Cannot implicitly convert type 'long' to 'uint'. An explicit conversion exists (are you missing a cast?)" and "Use of unassigned local variable 'lASTINPUTINFO'"
Please Guide me
Thanks
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace WindowsFormsApplication8
{
    internal class Win32
    {
        public Win32()
        {
        }
        public static uint GetIdleTime()
        {
            LASTINPUTINFO lASTINPUTINFO = new LASTINPUTINFO()
            {
                cbSize = (uint)Marshal.SizeOf<LASTINPUTINFO>(lASTINPUTINFO)
            };
            Win32.GetLastInputInfo(ref lASTINPUTINFO);
            return Environment.TickCount - lASTINPUTINFO.dwTime;
        }
        [DllImport("Kernel32.dll", CharSet = CharSet.None, ExactSpelling = false)]
        private static extern uint GetLastError();
        [DllImport("User32.dll", CharSet = CharSet.None, ExactSpelling = false)]
        private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
        public static long GetLastInputTime()
        {
            LASTINPUTINFO lASTINPUTINFO = new LASTINPUTINFO()
            {
                cbSize = (uint)Marshal.SizeOf<LASTINPUTINFO>(lASTINPUTINFO)
            };
            if (!Win32.GetLastInputInfo(ref lASTINPUTINFO))
            {
                throw new Exception(Win32.GetLastError().ToString());
            }
            return (long)lASTINPUTINFO.dwTime;
        }
        public static long GetTickCount()
        {
            return (long)Environment.TickCount;
        }
        [DllImport("User32.dll", CharSet = CharSet.None, ExactSpelling = false)]
        public static extern bool LockWorkStation();
    }
}
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WindowsFormsApplication8
{
    internal struct LASTINPUTINFO
    {
        public uint cbSize;
        public uint dwTime;
    }
}