当前位置:网站首页>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
边栏推荐
- spark:指定日期输出相应日期的日志(入门级-简单实现)
- The first n rows sorted after dataframe grouping nlargest argmax idmax tail!!!!
- 股票开户之后就可以购买6%的理财产品了?
- 华为无线设备配置WPA2-802.1X-AES安全策略
- The spiral matrix of the force buckle rotates together (you can understand it)
- 【OpenCV 例程300篇】238. OpenCV 中的 Harris 角点检测
- Spark Learning Notes (III) -- basic knowledge of spark core
- (零九)Flask有手就行——Cookie和Session
- pip换源
- Mysql库的操作
猜你喜欢

Existence form and legitimacy of real data in C language (floating point number)

文件操作详解

【MATLAB】MATLAB画图系列二 1.元胞与数组转化 2.属性元胞 3.删除nan值 4.合并多fig为同一fig 5.合并多fig至同一axes

ISPRS2018/云检测:Cloud/shadow detection based on spectral indices for multi/hyp基于光谱指数的多/高光谱光学遥感成像仪云/影检测

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

26.文件使用磁盘的代码实现

Leetcode 1288. delete the covered interval (yes, solved)

Deep learning 1 perceptron and implementation of simple back propagation network

26. Code implementation of file using disk

【USENIX ATC'22】支持异构GPU集群的超大规模模型的高效的分布式训练框架Whale
随机推荐
Summary of feature selection: filtered, wrapped, embedded
Which brokerage has the lowest commission? I want to open an account. Is it safe to open an account on my mobile phone
Jmmert aggregation test report
Fastjson code execution cve-2022-25845
Operation of MySQL Library
MySql函数
Spark Learning Notes (III) -- basic knowledge of spark core
Isprs2018/ cloud detection: cloud/shadow detection based on spectral indexes for multi/hyp multi / hyperspectral optical remote sensing imager cloud / shadow detection
REST风格
Mysql库的操作
Android section 13 detailed explanation of 03sqlite database
Kali concise language transformation method (illustration)
VS编译后的应用缺少dll
Grpc middleware implements grpc call retry
dataframe 分组后排序的前n行 nlargest argmax idmax tail !!!!
spark学习笔记(三)——sparkcore基础知识
Performance test - analyze requirements
Kotlin类与继承
Decrypt "sea Lotus" organization (domain control detection and defense)
Problems needing attention in mobile terminal testing