Henry Olive 5 Posted May 2, 2021 I wish everyone a healthy day Is there a away to prevent getting picture of a form ( Prevent Alt or Ctrl Print Screen ) ? Thank You 1 Share this post Link to post
Guest Posted May 2, 2021 Why? And even if you succeed, i could install screen-snap software like "snagit" or some such. I have not googled but you would probably install a hook in the OS. Share this post Link to post
Martin Wienold 35 Posted May 2, 2021 (edited) Maybe using Low Level Keyboard Hooks MSDN LowLevelKeyboardProc But the thing is, there are more ways to make a Screenshot than just using these Shortcuts, even without third party tools: Microsoft Snipping Tools Windows Key + Shift + S Print and MS Paint to cut the Screenshot You should ask yourself if you actually need to do this and save yourself the time and money. Edited May 2, 2021 by Martin Wienold 2 Share this post Link to post
Stano 143 Posted May 2, 2021 I've added the ability to print every form everywhere. It hasn't been written about taking a photo of the screen yet. So it's a completely useless effort. Share this post Link to post
Henry Olive 5 Posted May 2, 2021 (edited) What if the form shows digital Stamp & Signature ? My all other forms can make screen shot p.s : Even though i have below code on the form's OnCreate if dm.UsrRightADMINRIGHT.AsString ='No' then TabSheetStamp.TabVisible:=False; Edited May 2, 2021 by Henry Olive Share this post Link to post
Uwe Raabe 2057 Posted May 2, 2021 1 hour ago, Martin Wienold said: But the thing is, there are more ways to make a Screenshot than just using these Shortcuts, even without third party tools: Microsoft Snipping Tools Windows Key + Shift + S Print and MS Paint to cut the Screenshot Make a photo with your smartphone 1 2 Share this post Link to post
Henry Olive 5 Posted May 2, 2021 Thank you so much everbody. Uwe you made me laugh (You are absolutly right !!) Share this post Link to post
Martin Wienold 35 Posted May 2, 2021 Obligatory The Daily WTF link: Copy Protected 3 Share this post Link to post
Uwe Raabe 2057 Posted May 2, 2021 That was the story that I had in mind when writing my comment. Share this post Link to post
KodeZwerg 54 Posted May 2, 2021 Beside analog copy (smartphone) what cant be stopped (but can be a bit mangled if playing with display Hertz) and hooks to eat keyboard you can prevent digital copies (simple screencapture tools) by using overlay to draw screen or write direct to graphic card buffers. Simple Screencapture or Print would end with a black screen. Share this post Link to post
Remy Lebeau 1394 Posted May 3, 2021 On Windows 7 and later, you can use SetWindowDisplayAffinity() to specify that you want your Form window to only appear on a monitor display. That will omit (black) it out in screen captures, etc. 1 3 Share this post Link to post
Fr0sT.Brutal 900 Posted May 4, 2021 If you worry about copying signatures, you can slightly blur them so they will be readable but look modified. 1 Share this post Link to post
KodeZwerg 54 Posted May 4, 2021 (edited) 16 hours ago, Remy Lebeau said: On Windows 7 and later, you can use SetWindowDisplayAffinity() to specify that you want your Form window to only appear on a monitor display. That will omit (black) it out in screen captures, etc. SetWindowDisplayAffinity(Application.MainFormHandle, WDA_MONITOR); Does do nothing, did I called it wrong? //edit SetWindowDisplayAffinity(Application.MainFormHandle, WDA_MONITOR or WDA_EXCLUDEFROMCAPTURE); Also not working. (I called it in FormCreate event) Used Capture Software: Screenshot Captor from DonationCoder.com Tested on latest Windows 10 pro. Edited May 4, 2021 by KodeZwerg Share this post Link to post
David Heffernan 2345 Posted May 4, 2021 SetWindowDisplayAffinity(Application.MainFormHandle You really need to be calling this method from CreateWnd because of VCL window recreation. Also it's kinda odd that you would use MainFormHandle from a method of the main form. Why not use Handle? But it's important to move that code to CreateWnd. 1 Share this post Link to post
KodeZwerg 54 Posted May 4, 2021 1 hour ago, David Heffernan said: SetWindowDisplayAffinity(Application.MainFormHandle You really need to be calling this method from CreateWnd because of VCL window recreation. Also it's kinda odd that you would use MainFormHandle from a method of the main form. Why not use Handle? But it's important to move that code to CreateWnd. Thank you Mr. Heffernan, that work! type TfrmMain = class(TForm) protected procedure CreateWnd; override; end; implementation procedure TfrmMain.CreateWnd; begin inherited CreateWnd; SetWindowDisplayAffinity(Handle, WDA_MONITOR); end; Share this post Link to post
Guest Posted May 4, 2021 It's kind of cool that you folks made this work (!). I must quote M$ docs (cannot refrain), but i think you-all are aware. Quote This function and GetWindowDisplayAffinity are designed to support the window content protection feature that is new to Windows 7. This feature enables applications to protect their own onscreen window content from being captured or copied through a specific set of public operating system features and APIs. However, it works only when the Desktop Window Manager(DWM) is composing the desktop. It is important to note that unlike a security feature or an implementation of Digital Rights Management (DRM), there is no guarantee that using SetWindowDisplayAffinity and GetWindowDisplayAffinity, and other necessary functions such as DwmIsCompositionEnabled, will strictly protect windowed content, for example where someone takes a photograph of the screen. I guess teams and such software, when you share a "window" (not the entire desktop) uses this. And it works pretty good for that purpose. There seems to be some confusion in the docs as whether the functionality was created in order to prevent or enhance screen captures: Quote One use for this affinity is for windows that show video recording controls, so that the controls are not included in the capture. Anyway, interesting thread, good to be aware of this. Thanks. Share this post Link to post