VB.NET Programming
[VBNET] [API] 화면 캡쳐 방지 (Screen Capture Prevention)
ZerosKD
2020. 5. 26. 19:56
반응형
* VBNET API 를 이용한 화면 캡쳐 방지 (Screen Capture Prevention) 예제...
-사용한 컨트롤 : Button 1개
전체 소스 코드
Form1.vb
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("user32.dll")> Private Shared Function SetWindowDisplayAffinity(ByVal hWnd As IntPtr, _
ByVal dwAffinity As UInteger) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
Private Const ui_NONE As UInteger = &H0
Private Const ui_SET As UInteger = &H1
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
If button1.Text = "캡처 방지 설정하기" Then
SetWindowDisplayAffinity(Me.Handle, ui_SET)
button1.Text = "캡처 방지 해제하기"
Else
SetWindowDisplayAffinity(Me.Handle, ui_NONE)
button1.Text = "캡처 방지 설정하기"
End If
End Sub
End Class
*예제 결과
- 해지 했을 경우
- 설정 했을 경우
반응형