Results 1 to 6 of 6

Thread: crippling GetDC

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2001
    Posts
    46

    crippling GetDC

    Anyone know how to cripple GetDC to prevent screen capture? (like clevercontent.com )

  2. #2
    jim mcnamara
    Guest
    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.

  3. #3
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    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.

    Code:
    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
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2001
    Posts
    46
    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)

  5. #5
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611
    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.
    Looking for a friendly intelligent chat forum? Visit the white-hart.net

  6. #6
    Lively Member
    Join Date
    Aug 2001
    Posts
    109
    I bet your trying to create a cheat that dissallows punkbuster from taking screenshots during your gameplay?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width