基本信息
源码名称:C# 制作好看的挂机锁(屏蔽Alt+Tab+任务管理器)
源码大小:10.59M
文件格式:.rar
开发语言:C#
更新时间:2020-01-10
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍



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);
        }
    }
}