0
点赞
收藏
分享

微信扫一扫

[C#][原创]反截图研究

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
 
namespace FIRC
{
    public class ScreenShotProtect
    {
        [DllImport("user32.dll")]
        private static extern uint SetWindowDisplayAffinity(IntPtr hwnd, uint dwAffinity);
        public bool HasProtect
        {
            get { return isProtect; }
        }
        private bool isProtect = false;
 
        public void Protect(IntPtr handle)
        {
            SetWindowDisplayAffinity(handle, 1);
            isProtect = true;
        }
        public void UnProtect(IntPtr handle)
        {
            if (isProtect)
            {
                SetWindowDisplayAffinity(handle, 0);
                isProtect = false;
            }
 
        }
 
    }
}

举报

相关推荐

0 条评论