PDA

Click to See Complete Forum and Search --> : crippling GetDC


Piltdown Man
Aug 19th, 2001, 12:02 PM
Anyone know how to cripple GetDC to prevent screen capture? (like clevercontent.com )

jim mcnamara
Aug 19th, 2001, 02:10 PM
There is a pool of device contexts maintained by the OS.

If you repeatedly call GetDC until it fails, you have exhausted the pool. This basically locks up the graphics output on the system, except for CreateDC. This is not a good idea, because you have to restore them with ReleaseDC before you exit your code, and some windows will become blocked, which can cause permanent deadlocks because they have a mutex on a resource your code needs - non-DC resource.

YoungBuck
Aug 19th, 2001, 10:17 PM
This is one way to 'disable' the PrintScreen key. Run a DoEvents loop and check the state if the Print Screen key, if it is pressed then Clear the clipboard object.



Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const VK_PRNTSCRN = &H2C

Private Sub Form_Load()

Me.Show

Do Until DoEvents = 0

' if print screen button pressed
If GetAsyncKeyState(VK_PRNTSCRN) Then

Clipboard.Clear

End If

Loop

End Sub

Piltdown Man
Sep 11th, 2001, 02:14 PM
Originally posted by jim mcnamara
There is a pool of device contexts maintained by the OS.

If you repeatedly call GetDC until it fails, you have exhausted the pool. This basically locks up the graphics output on the system, except for CreateDC.

any idea how big the pool is? My attempts seem to just slow down the system without exhaustiung the pool.


Originally posted by jim mcnamara
Youngbuck

The clipboard clearing is not general enough I'm afraid (doesn't stop things like PSP)

Kzin
Dec 2nd, 2001, 03:09 PM
Originally posted by jim mcnamara
There is a pool of device contexts maintained by the OS.

If you repeatedly call GetDC until it fails, you have exhausted the pool. This basically locks up the graphics output on the system, except for CreateDC. This is not a good idea, because you have to restore them with ReleaseDC before you exit your code, and some windows will become blocked, which can cause permanent deadlocks because they have a mutex on a resource your code needs - non-DC resource.

Jim;Pilt

After painting with a common DC, the ReleaseDC function must be called to release the DC. Class and private DCs do not have to be released. ReleaseDC must be called from the same thread that called GetDC. The number of DCs is limited only by available memory.

Windows 95/98/Me: There are only 5 common DCs available per thread, thus failure to release a DC can prevent other applications from accessing one.

AlbafaN
Dec 4th, 2001, 10:43 AM
I bet your trying to create a cheat that dissallows punkbuster from taking screenshots during your gameplay? :p