当前位置:网站首页>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
边栏推荐
- Date processing bean
- kali简洁转换语言方法(图解)
- Data analysis and mining 1
- pytorch with torch.no_grad
- 【OpenCV 例程300篇】238. OpenCV 中的 Harris 角点检测
- Leetcode · daily question · 1184. distance between bus stops · simulation
- Machine learning practice notes
- Route planning method for UAV in unknown environment based on improved SAS algorithm
- Kotlin class and inheritance
- How vscode debug nodejs
猜你喜欢

24.原生磁盘的使用

spark:获取日志中每个时间段的访问量(入门级-简单实现)

25. From disk to file

(09) flask is OK if it has hands - cookies and sessions

Isprs2018/ cloud detection: cloud/shadow detection based on spectral indexes for multi/hyp multi / hyperspectral optical remote sensing imager cloud / shadow detection

打假Yolov7的精度,不是所有的论文都是真实可信

Deep learning 1 perceptron and implementation of simple back propagation network

Outlook tutorial, how to create tasks and to DOS in outlook?
DS binary tree - parent and child nodes of binary tree

华为无线设备配置WPA2-802.1X-AES安全策略
随机推荐
老虎口瀑布:铜梁版小壶口瀑布
Data analysis and mining 2
zabbix管理员忘记登录密码
The server switches between different CONDA environments and views various user processes
Learning and thinking about the relevant knowledge in the direction of building network security knowledge base
dataframe 分组后排序的前n行 nlargest argmax idmax tail !!!!
pytorch with torch.no_grad
Simple encapsulation of wechat applet wx.request
Tiger mouth waterfall: Tongliang version of xiaohukou waterfall
26. Code implementation of file using disk
ISPRS2018/云检测:Cloud/shadow detection based on spectral indices for multi/hyp基于光谱指数的多/高光谱光学遥感成像仪云/影检测
Isprs2018/ cloud detection: cloud/shadow detection based on spectral indexes for multi/hyp multi / hyperspectral optical remote sensing imager cloud / shadow detection
Huawei camera capability
SQL的SELF JOIN用法
Kali concise language transformation method (illustration)
[USENIX atc'22] an efficient distributed training framework whale that supports the super large-scale model of heterogeneous GPU clusters
图的存储和遍历
The difference and relation among list, set and map
A common Dao class and util
[matlab] matlab drawing Series II 1. Cell and array conversion 2. Attribute cell 3. delete Nan value 4. Merge multiple figs into the same Fig 5. Merge multiple figs into the same axes