防止應用程序截屏(容器式,防止極域電子教室和錄屏軟件錄制)

核心原理、實現目的

1、使用Panel容器將外部窗口嵌入自己寫的程序

2、使用防止截屏的函數來對窗口透明,這可以使本窗口內所有窗口在錄屏軟件上消失

3、解放,抓取,存儲句柄,實現擺脫錄屏(極域監控)

程序設計

本人始終堅持使用vb.net來編程,不是C#難學,而是vb.net更有性價比……C#源碼可以自行翻譯C#與vb.net互相轉換

中間那一坨是Panel容器,也可以替換成別的控件

如何選取窗口?

看到座上的一個按鈕,顯示的是一個“+”

按住它不放并且移動到窗口上即可,注意的是,最好要移動到窗口的標題欄或者是邊框上才算是該窗體的最終窗體,本人編程能力有限,目前功能不是很完善

此時松開鼠標,就可以看到label處是對應的窗口的名字,listbox內是歷史窗口的句柄信息和窗口標題。

如何將目標窗口拖入容器?

點擊放入容器,即可將選定窗口或當前選定窗口“嵌入” panel

點擊移出容器即可將選定窗口或當前選定窗口“擠出” panel

如何防止截屏?

按下防止截屏即可,此時按鈕為紅色,容器內窗口為無法錄制(截屏),這樣性能會變差,可以在必要時恢復錄制

代碼

API解讀

全部封裝到模塊

    ''' <summary>''' 屏幕坐標->窗口句柄,實現鼠標移動到哪就得到什么窗口的句柄''' </summary>''' <param name="xPoint"></param>''' <param name="yPoint"></param>''' <returns></returns><DllImport("user32.dll", EntryPoint:="WindowFromPoint")>Public Function WindowFromPoint(xPoint As Integer, yPoint As Integer) As IntPtrEnd Function''' <summary>''' 防止截屏的核心,設置窗口是否可錄制''' </summary>''' <param name="hWnd"></param>''' <param name="dwAffinity">常量</param>''' <returns></returns><DllImport("user32.dll")>Public Function SetWindowDisplayAffinity(hWnd As IntPtr, dwAffinity As Integer) As BooleanEnd Function''' <summary>''' 獲取窗口標題,注意需要一個外部變量存儲標題名稱,是ByRef / out''' </summary>''' <param name="hWnd"></param>''' <param name="lpString"></param>''' <param name="nMaxCount">接收的最大值</param>''' <returns></returns><DllImport("user32.dll", EntryPoint:="GetWindowText")>Public Function GetWindowText(hWnd As IntPtr, lpString As StringBuilder, nMaxCount As Integer) As IntegerEnd Function''' <summary>''' 設置窗口的父容器''' </summary>''' <param name="hWndChild"></param>''' <param name="hWndNewParent">此處寫IntPtr.Zero則移除容器</param>''' <returns></returns><DllImport("user32.dll ", EntryPoint:="SetParent")>Public Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtrEnd Function''' <summary>''' 改變窗口形態''' </summary>''' <param name="hwnd"></param>''' <param name="nCmdShow">常量</param>''' <returns></returns><DllImport("user32.dll", EntryPoint:="ShowWindow", CharSet:=CharSet.Auto)>Public Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Integer) As IntegerEnd Function''' <summary>''' 查找標題窗口''' </summary>''' <param name="lpClassName">可為空</param>''' <param name="lpWindowName"></param>''' <returns></returns><DllImport("user32.dll")>Public Function FindWindow(lpClassName As String, lpWindowName As String) As IntPtrEnd Function

?常量聲明

SetWindowDisplayAffinity

?ShowWindow

主要代碼

請自行分離代碼

初始化

Dim ispick As Boolean
Public Const WDA_NONE = &H0
Public Const WDA_EXCLUDEFROMCAPTURE = &H11
Dim s As New StringBuilder
Dim hwnd As IntPtr
Dim childHwnd As IntPtr'沒用Dim dirHwnd As New List(Of HwndName)Dim jiyuPath As StringPublic KeyHandle As Integer'沒用
Structure HwndNameDim hwnd As IntPtrDim text As StringSub New(hwnd As IntPtr, text As String)Me.hwnd = hwndMe.text = textEnd Sub
End Structure

截屏組

'''防止截屏
SetWindowDisplayAffinity(Me.Handle, WDA_EXCLUDEFROMCAPTURE)
Button2.BackColor = Color.Red
Button3.BackColor = Color.Blue
'''恢復截屏
SetWindowDisplayAffinity(Handle, WDA_NONE)
Button2.BackColor = Color.Blue
Button3.BackColor = Color.Red

容器組

'''放入容器 這里if可以排除其他控件,防止手欠把自己的控件也嵌入panel
If Label1.Text <> "+" ThenSetParent(hwnd, Panel1.Handle)
End If
'''移出容器
SetParent(hwnd, IntPtr.Zero)
'''更新(最大化窗口)
SetParent(hwnd, Panel1.Handle)
ShowWindow(hwnd, 3)

選取窗口

'''按下
Private Sub Button1_MouseDown(sender As Object, e As MouseEventArgs) Handles Button1.MouseDownispick = TrueEnd Sub
'''移動
Private Sub Button1_MouseMove(sender As Object, e As MouseEventArgs) Handles Button1.MouseMoveIf ispick = True Thenhwnd = WindowFromPoint(MousePosition.X, MousePosition.Y)GetWindowText(hwnd, s, 255)Label1.Text = s.ToStringEnd If
End Sub
'''松開
Private Sub Button1_MouseUp(sender As Object, e As MouseEventArgs) Handles Button1.MouseUpispick = FalsedirHwnd.Add(New HwndName(hwnd, s.ToString))ListHwnd.Items.Clear()For Each item In dirHwndListHwnd.Items.Add("標題:" & item.text & " 句柄:" & item.hwnd.ToString)Next
End Sub

其余代碼

Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles Me.ResizePanel1.Width = Width - Panel1.Location.X - 25Panel1.Height = Height - 75
End SubPrivate Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChangedIf CheckBox1.Checked = False ThenMe.TopMost = FalseElseTopMost = TrueEnd If
End SubPrivate Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.TickIf TopMost = True ThenTopMost = TrueEnd If
End Sub
'可以不寫
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.ClickForm2.Show()Dim hwndhwnd = FindWindow(vbNullString, "屏幕廣播")SetParent(hwnd, Form2.Panel2.Handle)ShowWindow(hwnd, 3)'SetWindowDisplayAffinity(Form2.Handle, WDA_EXCLUDEFROMCAPTURE)
End SubPrivate Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.LoadFor Each p In Process.GetProcessesIf p.ProcessName = "StudentMain" ThenjiyuPath = p.MainModule.FileNameEnd IfNextIf jiyuPath = "" ThenMsgBox("極域未運行,請在極域運行后點擊啟動極域即可完成操作")End IfCheckBox1.Checked = True
End SubPrivate Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.ClickIO.File.WriteAllBytes("C:/助手.exe", My.Resources.v1_2_助手_64位)Process.Start("C:/助手.exe")
End SubPrivate Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.ClickIO.File.WriteAllText("C:/RootCA.reg", My.Resources.RootCA)Process.Start("regedit", "/s C:/RootCA.reg")
End SubPrivate Sub ListHwnd_SelectedValueChanged(sender As Object, e As EventArgs) Handles ListHwnd.SelectedValueChangedIf ListHwnd.SelectedIndex <> -1 Thenhwnd = dirHwnd(ListHwnd.SelectedIndex).hwndLabel1.Text = dirHwnd(ListHwnd.SelectedIndex).textEnd If
End SubPrivate Sub Button10_Click_1(sender As Object, e As EventArgs) Handles Button10.ClickIf jiyuPath = "" ThenFor Each p In Process.GetProcessesIf p.ProcessName = "StudentMain" ThenjiyuPath = p.MainModule.FileNameEnd IfNextIf jiyuPath = "" ThenMsgBox("極域未運行,請在極域運行后點擊啟動極域即可完成操作")End IfElseProcess.Start(jiyuPath)End If
End SubPrivate Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.ClickProcess.Start("cmd", "/c taskkill /f /im studentmain.exe")
End Sub

源程序和源代碼應該會在開頭有,感謝博主小流汗黃豆提供的應用程序和設計思路小流汗黃豆?

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/168027.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/168027.shtml
英文地址,請注明出處:http://en.pswp.cn/news/168027.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

用 Addon 增強 Node.js 和 Electron 應用的原生能力

前言 Node.js Addon 是 Node.js 中為 JavaScript 環境提供 C/C 交互能力的機制。其形態十分類似 Java 的 JNI&#xff0c;都是通過提供一套 C/C SDK&#xff0c;用于在 C/C 中創建函數方法、進行數據轉換&#xff0c;以便 JavaScript / Java 等語言進行調用。這樣編寫的代碼通常…

Spring - Mybatis-設計模式總結

Mybatis-設計模式總結 1、Builder模式 2、工廠模式 3、單例模式 4、代理模式 5、組合模式 6、模板方法模式 7、適配器模式 8、裝飾者模式 9、迭代器模式 雖然我們都知道有26個設計模式&#xff0c;但是大多停留在概念層面&#xff0c;真實開發中很少遇到&#xff0c;…

【數據結構】時間和空間復雜度

馬上就要進入到數據結構的學習了 &#xff0c;我們先來了解一下時間和空間復雜度&#xff0c;這也可以判斷我們的算法是否好壞&#xff1b; 如何衡量一個算法的好壞&#xff1f; 就是看它的算法效率 算法效率 算法效率分析分為兩種&#xff1a;第一種是時間效率&#xff0c;第…

C++ Qt QVariant類型使用介紹與代碼演示

作者:令狐掌門 技術交流QQ群:675120140 csdn博客:https://mingshiqiang.blog.csdn.net/ 文章目錄 一、QVariant基本用法二、自定義類型使用QVariant三、其它用法賦值修改和替換值使用`QVariant::setValue()`設置值復制構造函數和賦值操作比較使用`QVariant::swap()`交換值使…

CVE-2023-22515:Atlassian Confluence權限提升漏洞復現 [附POC]

文章目錄 Atlassian Confluence權限提升(CVE-2023-22515)漏洞復現 [附POC]0x01 前言0x02 漏洞描述0x03 影響版本0x04 漏洞環境0x05 漏洞復現1.訪問漏洞環境2.構造POC3.復現 0x06 修復建議 Atlassian Confluence權限提升(CVE-2023-22515)漏洞復現 [附POC] 0x01 前言 免責聲明&…

vue中下載文件后無法打開的坑

今天在項目開發的時候臨時要添加個導出功能我就寫了一份請求加導出得代碼&#xff0c; 代碼&#xff1a; //導出按鈕放開exportDutySummarizing (dataRangeInfo) {const params {departmentName: dataRangeInfo.name,departmentQode: dataRangeInfo.qode}//拼接所需得urlcons…

UserRole

Qt::UserRole 是 Qt::ItemDataRole 枚舉中的一個成員&#xff0c;用于表示自定義數據角色&#xff08;Data Role&#xff09;的起始值。 在 Qt 中&#xff0c;Qt::ItemDataRole 枚舉用于標識項&#xff08;Item&#xff09;中不同類型的數據。這些數據角色包括 Qt::DisplayRol…

目標檢測YOLO系列從入門到精通技術詳解100篇-【目標檢測】紅外熱成像

目錄 前言 知識儲備 紅外熱成像儀基礎知識 算法原理 紅外熱成像探測距離 紅外圖像增強

第一百七十八回 介紹一個三方包組件:SlideSwitch

文章目錄 1. 概念介紹2. 使用方法3. 代碼與效果3.1 示例代碼3.2 運行效果 4. 內容總結 我們在上一章回中介紹了"如何創建垂直方向的Switch"相關的內容&#xff0c;本章回中將 介紹SlideSwitch組件.閑話休提&#xff0c;讓我們一起Talk Flutter吧。 1. 概念介紹 我們…

多功能智能燈桿主要功能有哪些?

多功能智能燈桿這個詞相信大家都不陌生&#xff0c;最近幾年多功能智能燈桿行業發展迅速&#xff0c;迅速取代了傳統路燈&#xff0c;那么多功能智能燈桿相比傳統照明路燈好在哪里呢&#xff0c;為什么大家都選擇使用叁仟智慧多功能智能燈桿呢&#xff1f;所謂多功能智能燈桿著…

【libGDX】Mesh紋理貼圖

1 前言 紋理貼圖的本質是將圖片的紋理坐標與模型的頂點坐標建立一一映射關系。紋理坐標的 x、y 軸正方向分別朝右和朝下&#xff0c;如下。 2 紋理貼圖 本節將使用 Mesh、ShaderProgram、Shader 實現紋理貼圖&#xff0c;OpenGL ES 的實現見博客 → 紋理貼圖。 DesktopLauncher…

超級應用平臺(HAP)起航

各位明道云用戶和伙伴&#xff0c; 今天&#xff0c;我們正式發布明道云10.0版本。從這個版本開始&#xff0c;我們將產品名稱正式命名為超級應用平臺&#xff08;Hyper Application Platform, 簡稱HAP&#xff09;。我們用“超級”二字表達產品在綜合能力方面的突破&#xff…

清華系下一代 LCM

LCM LoRA模型是一種創新的深度學習模型&#xff0c;它通過特殊的技術手段&#xff0c;顯著提高了圖像生成的效率。這種模型特別適用于需要快速生成高質量圖像的場景&#xff0c;如藝術創作、實時圖像處理等。 GitHub - luosiallen/latent-consistency-model: Latent Consistenc…

視頻監控中的智能算法與計算機視覺技術

智能視頻監控是一種基于人工智能技術的監控系統&#xff0c;它能夠通過對圖像和視頻數據進行分析&#xff0c;自動識別目標物體、判斷其行為以及進行異常檢測等功能&#xff0c;從而實現對場景的智能化監管。以下是常見的一些用于智能視頻監控的算法&#xff1a; 1、人臉識別技…

RabbitMQ簡易安裝

一般來說安裝 RabbitMQ 之前要安裝 Erlang &#xff0c;可以去Erlang官網下載。接著去RabbitMQ官網下載安裝包&#xff0c;之后解壓縮即可。 Erlang官方下載地址&#xff1a;Downloads - Erlang/OTP RabbitMQ官方下載地址&#xff1a;Downloading and Installing RabbitMQ —…

org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder

密碼&#xff0c;加密&#xff0c;解密 spring-security-crypto-5.7.3.jar /** Copyright 2002-2011 the original author or authors.** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with t…

Kafka(一)

一&#xff1a;簡介 解決高吞吐量項目的需求 是一款為大數據而生的消息中間件&#xff0c;具有百億級tps的吞吐量&#xff0c;在數據采集、傳輸、存儲的過程中發揮著作用 二&#xff1a;為什么要使用消息隊列 一個普通訪問量的接口和一個大并發的接口&#xff0c;它們背后的…

C/C++---------------LeetCode第1512. 好數對的數目

好數對的數目 題目及要求暴力算法哈希算法在main內使用 題目及要求 給你一個整數數組 nums 。 如果一組數字 (i,j) 滿足 nums[i] nums[j] 且 i < j &#xff0c;就可以認為這是一組 好數對 。 返回好數對的數目。 示例 1&#xff1a; 輸入&#xff1a;nums [1,2,3,1,…

376.擺動序列

原題鏈接&#xff1a;376.擺動序列 全代碼&#xff1a; class Solution { public:int wiggleMaxLength(vector<int>& nums) {if (nums.size() < 1) return nums.size();int curDiff 0; // 當前一對差值int preDiff 0; // 前一對差值int result 1; // 記錄峰…

Android骨架圖

用法&#xff1a;在圖片上實現動畫效果 <FrameLayoutandroid:id"id/image_container"android:layout_width"match_parent"android:layout_height"wrap_content"><ImageViewandroid:id"id/ivBlank"android:layout_width"…