首页

C# 制作好看的挂机锁(屏蔽Alt+Tab+任务管理器)

c#

2020-9-10

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using System.Collections;

namespace 卡萌
{
    public partial class Form2 : Form
    {
        Form S;//目的是为了Form2加载时就创建Form3并隐藏,点击窗口时再显示Form3
        ArrayList Myali=new ArrayList();
        public Form2()
        {
            InitializeComponent();
        }
        //屏蔽窗口显示
        protected override CreateParams CreateParams
        {
            get
            {
                const int WS_EX_APPWINDOW = 0x40000;
                const int WS_EX_TOOLWINDOW = 0x80;
                CreateParams cp = base.CreateParams;
                cp.ExStyle &= (~WS_EX_APPWINDOW);    // 不显示在TaskBar
                cp.ExStyle |= WS_EX_TOOLWINDOW;      // 不显示在Alt Tab
                return cp;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        private void GetImg()
        {
            Myali.Clear();
            string Filepath = Application.ExecutablePath;
            string Imgpath =Filepath.Substring(0,Filepath.LastIndexOf(@"\") 1) "Img";
            DirectoryInfo Dir = new DirectoryInfo(Imgpath);
            FileSystemInfo[] Pics = Dir.GetFiles();
            foreach (FileSystemInfo singlepic in  Pics )
            {
             string fileType = singlepic.ToString().Substring(singlepic.ToString().LastIndexOf(".")   1, singlepic.ToString().Length - singlepic.ToString().LastIndexOf(".") - 1);
             fileType = fileType.ToLower();
             if (fileType == "jpeg" || fileType == "jpg" || fileType == "bmp" || fileType == "png")
             {
                 Myali.Add(Filepath.Substring(0, Filepath.LastIndexOf(@"\")   1)   "Img\\" singlepic.ToString());
                 
             }
                
            }

            
        }


        private void Form2_Load(object sender, EventArgs e)
        {
            S = null;
            S = new Form3();
            timer1.Start();
            GetImg();
            label1.Text = Pass.Mwd;
            label1.Left = (this.ClientSize.Width - label1.Width) / 2;
            Random Rd = new Random();
            int Id = Rd.Next(0, Myali.Count - 1);
            this.BackgroundImage = Image.FromFile(Myali[Id].ToString());
            this.BackgroundImageLayout = ImageLayout.Stretch;
            base.Opacity = 0.85;
            
           //GetImg();
            //MessageBox.Show(Application.ExecutablePath);
        }

        private void Form2_KeyDown(object sender, KeyEventArgs e)
        {

            if (e.Modifiers.CompareTo(Keys.Alt) == 0 && e.KeyCode == Keys.F4)
            {
                    S.Visible = true;
                    e.Handled = true;
            }
           
            if (e.KeyCode==Keys.Space||e.KeyCode==Keys.Enter)
            {
                S.Visible = true;
                e.Handled = true;
            }



        }

        private void button1_KeyDown(object sender, KeyEventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void Form2_Click(object sender, EventArgs e)
        {
            S.Visible = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                Process[] Ps = Process.GetProcesses();
                foreach (Process P in Ps)
                {
                    if (P.ProcessName.ToString().ToLower().Equals("taskmgr") || P.ProcessName.ToString().ToLower().Equals("cmd"))
                    {
                        P.Kill();
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("请输入解锁密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
           
        }

        private void Form2_MouseMove(object sender, MouseEventArgs e)
        {
            Cursor.Clip = new Rectangle(591,339,S.Width,S.Height);
        }
    }
}

资源下载此资源下载价格为3D币(VIP免费),请先
资源文件列表
卡萌/卡萌/66.ico , 1880
卡萌/卡萌/App.config , 187
卡萌/卡萌/bin/Debug/Ico/卡萌.ico , 12288
卡萌/卡萌/bin/Debug/Img/111.jpg , 97486
卡萌/卡萌/bin/Debug/Img/20140605114503719.jpg , 49948
卡萌/卡萌/bin/Debug/Img/6d0ff132830616fb901f533b86553cad29a2e365.jpg , 856348
卡萌/卡萌/bin/Debug/Img/9658897f83c5ac28b9ca7152f4d95186.jpg , 100685
卡萌/卡萌/bin/Debug/Img/97ef0a80ae67a205f3874446e5d7037e.jpg , 148364
卡萌/卡萌/bin/Debug/Img/a3ac63512142706c65557e8bce5db8ffdaf4d713315.png , 2294899
卡萌/卡萌/bin/Debug/Img/a3ac63512142706c657e85bce5db8ffdaf4d713315.png , 1893769
卡萌/卡萌/bin/Debug/Img/a3ac63512142706c657e8bce5db8ffdaf4d713315.png , 1908541
卡萌/卡萌/bin/Debug/Img/a3ac635121542706c657e8bce5db8ffdaf4d713315.png , 3137580
卡萌/卡萌/bin/Debug/卡萌.exe , 179712
卡萌/卡萌/bin/Debug/卡萌.exe.config , 187
卡萌/卡萌/bin/Debug/卡萌.pdb , 36352
卡萌/卡萌/bin/Debug/卡萌.vshost.exe , 22984
卡萌/卡萌/bin/Debug/卡萌.vshost.exe.config , 187
卡萌/卡萌/bin/Debug/卡萌.vshost.exe.manifest , 490
卡萌/卡萌/Form1.cs , 2271
卡萌/卡萌/Form1.Designer.cs , 9819
卡萌/卡萌/Form1.resx , 104712
卡萌/卡萌/Form2.cs , 4469
卡萌/卡萌/Form2.Designer.cs , 3339
卡萌/卡萌/Form2.resx , 6011
卡萌/卡萌/Form3.cs , 1947
卡萌/卡萌/Form3.Designer.cs , 7235
卡萌/卡萌/Form3.resx , 129276
卡萌/卡萌/music_ic_my_voice.ico , 2326
卡萌/卡萌/obj/Debug/DesignTimeResolveAssemblyReferences.cache , 1308
卡萌/卡萌/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache , 7208
卡萌/卡萌/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs , 0
卡萌/卡萌/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs , 0
卡萌/卡萌/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs , 0
卡萌/卡萌/obj/Debug/卡萌.csproj.FileListAbsolute.txt , 921
卡萌/卡萌/obj/Debug/卡萌.csproj.GenerateResource.Cache , 1091
卡萌/卡萌/obj/Debug/卡萌.csprojResolveAssemblyReference.cache , 2209
卡萌/卡萌/obj/Debug/卡萌.exe , 179712
卡萌/卡萌/obj/Debug/卡萌.Form1.resources , 66466
卡萌/卡萌/obj/Debug/卡萌.Form2.resources , 180
卡萌/卡萌/obj/Debug/卡萌.Form3.resources , 82766
卡萌/卡萌/obj/Debug/卡萌.pdb , 36352
卡萌/卡萌/obj/Debug/卡萌.Properties.Resources.resources , 180
卡萌/卡萌/Program.cs , 642
卡萌/卡萌/Properties/AssemblyInfo.cs , 1332
卡萌/卡萌/Properties/Resources.Designer.cs , 2864
卡萌/卡萌/Properties/Resources.resx , 5612
卡萌/卡萌/Properties/Settings.Designer.cs , 1093
卡萌/卡萌/Properties/Settings.settings , 249
卡萌/卡萌/卡萌.csproj , 4641
卡萌/卡萌/卡萌.ico , 12288
卡萌/卡萌.sln , 908
卡萌/卡萌.v11.suo , 56832
没有账号? 忘记密码?

社交账号快速登录