Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SetWindowDisplayAffinity - Protect window from screenshots/Software capture ?
#2
It only works if the window belongs to the current process

from MSDNParameters 
Code:
Copy      Help
[in] hWnd
Type: HWND
A handle to the top-level window. The window must belong to the current process.

this will work as dialog belongs to same process

Function DialogExample
Code:
Copy      Help
dll user32
,#SetWindowDisplayAffinity hWnd dwFlags
,#GetWindowDisplayAffinity hWnd pdwAffinity
def WDA_NONE 0x00000000
def WDA_MONITOR 0x00000001
def WDA_EXCLUDEFROMCAPTURE 0x00000011

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Static 0x54000000 0x0 72 0 48 12 "Test"
;4 Edit 0x54030080 0x200 64 36 96 13 ""
;5 Edit 0x54030080 0x200 64 64 96 12 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C00 "*" "" "" ""

str controls = "4 5"
str e4 e5
e4="test1"
e5="test2"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,SetWindowDisplayAffinity(hDlg WDA_EXCLUDEFROMCAPTURE)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


Messages In This Thread
RE: SetWindowDisplayAffinity - Protect window from screenshots/Software capture ? - by Kevin - 01-31-2022, 03:39 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)