当前位置:网站首页>C # exit login if there is no operation
C # exit login if there is no operation
2022-07-24 15:11:00 【ITKEY_】
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace LockScreenMsg
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
label1.Height = 200;
}
[StructLayout(LayoutKind.Sequential)]
struct LASTINPUTINFO
{
[MarshalAs(UnmanagedType.U4)]
public int cbSize;
[MarshalAs(UnmanagedType.U4)]
public uint dwTime;
}
[DllImport("user32.dll")]
static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
static long GetLastInputTime()
{
LASTINPUTINFO vLastInputInfo = new LASTINPUTINFO();
vLastInputInfo.cbSize = Marshal.SizeOf(vLastInputInfo);
if (!GetLastInputInfo(ref vLastInputInfo))
{
return 0;
}
return Environment.TickCount - (long)vLastInputInfo.dwTime;
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Enabled = true;
}
public string isNull = null;
private void timer1_Tick(object sender, EventArgs e)
{
long time=GetLastInputTime()/1000;
this.label1.Text = string.Format(" Users have {0} Seconds no operation ", time);
if (time >= 20)
{
this.Close();
}
}
}
}
Reference resources
边栏推荐
- 哈夫曼树(最优二叉树)
- Number of bytes occupied by variables of type char short int in memory
- Wildfire STM32 domineering, through the firmware library to achieve water light
- Kotlin class and inheritance
- REST风格
- 深度学习中的学习率调整策略(1)
- ZABBIX administrator forgot login password
- Android section 13 detailed explanation of 03sqlite database
- The accuracy of yolov7 in cracking down on counterfeits, not all papers are authentic
- Simple encapsulation of wechat applet wx.request
猜你喜欢

(零九)Flask有手就行——Cookie和Session

Leetcode-09 (next rank + happy number + full rank)

Android SQLite database practice

Jmmert aggregation test report

LeetCode高频题56. 合并区间,将重叠的区间合并为一个区间,包含所有区间

Number of bytes occupied by variables of type char short int in memory

Production environment tidb cluster capacity reduction tikv operation steps

Leetcode high frequency question 56. merge intervals, merge overlapping intervals into one interval, including all intervals

老虎口瀑布:铜梁版小壶口瀑布

Detailed explanation of address bus, data bus and control bus
随机推荐
Leetcode high frequency question 56. merge intervals, merge overlapping intervals into one interval, including all intervals
zabbix管理员忘记登录密码
Can you buy 6% of financial products after opening a stock account?
Data analysis and mining 2
File upload and download and conversion between excel and data sheet data
The difference and relation among list, set and map
Applet tab
Detailed explanation of IO model (easy to understand)
Which securities company is good at opening an account with flush? Excuse me, is it safe to open an account with mobile phone or stock?
Summary of feature selection: filtered, wrapped, embedded
Fraud detection cases and Titanic rescued cases
Existence form and legitimacy of real data in C language (floating point number)
Tiger mouth waterfall: Tongliang version of xiaohukou waterfall
C# SQLite Database Locked exception
Time series of machine learning
C language large and small end mode judgment function
Overview of dobesie wavelet (DB wavelet function) in wavelet transform
哈夫曼树(最优二叉树)
dataframe 分组后排序的前n行 nlargest argmax idmax tail !!!!
Discussion on the basic use and address of pointer in array object