Results 1 to 5 of 5

Thread: [RESOLVED] Fullscreen magnifier glass

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    Resolved [RESOLVED] Fullscreen magnifier glass

    Hello everyone, been a while since posting here...

    I'm trying to write a full-screen magnification program in Visual basic .NET, which will likely utilize the Windows API (Pinvoke) to do it's magic.
    The problem I am running into is that, when capturing the screen, you inevitably capture the window you display it on as well.
    You get the 'infiniwindow' effect, where the captured image is captured and displayed again. It also results in strange glitches when you have a dynamic moving image.

    I have tried several ways to capture the screen and displaying it WITHOUT ending up capturing my own drawn window. To do so, I need to draw 'above' the zero-DC buffer.

    This is the method I used to draw to the screen (no topmost window as that gets inevitably captured too):
    PHP Code:
    Public Class Magnifier
        Dim screen 
    As Screen
        Dim bounds 
    As Rectangle
        Dim g 
    As Graphics
        Dim zoom 
    As Double

        
    Public Sub New(ByVal screen As Screen)
            
    Me.screen screen
            Me
    .bounds Me.screen.Bounds
            Me
    .Graphics.FromHwnd(IntPtr.Zero)
        
    End Sub

        
    Public Sub Dispose()
            
    g.Dispose()
        
    End Sub

        
    Public Sub SetZoom(ByVal zoom As Double)
            
    Me.zoom zoom
        End Sub

        
    Public Sub Draw()
            
    g.CopyFromScreen(Cursor.Position, New Point(00), New Size(400400))
        
    End Sub
    End 
    Class 
    As you can see, getting the Graphics for handle IntPtr.ZERO results in the same graphics used to capture the screen. So, I end up capturing myself.
    Draw is fired elsewhere using a timer.

    Is there some way to capture the screen while EXCLUDING everything I rendered 'on top' of it? Can it be done with a fullscreen topmost window?
    Alternatively, is it possible to be 'the man in the middle' transforming the graphics right before it is drawn to screen?

Tags for this Thread

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