1. hidden graphics

Does anyone know how to tell what screen graphics are underneath
my program's window when it's overlapping another program that's
running. ..thanks again... timmy

new topic     » topic index » view message » categorize

2. Re: hidden graphics

On Wed, 22 Dec 1999 04:41:00 -0800, timmy <tim781 at PACBELL.NET> wrote:

>Does anyone know how to tell what screen graphics are underneath
>my program's window when it's overlapping another program that's
>running. ..thanks again... timmy

I dunno if there's an API call for it but using the tools provided in
Win32Lib I would get the Window size, create a Pixmap buffer of the same
size, hide the window, use the window size to copy the Screen to the
buffer, then show the window again.  Now you have a copy of what's behind
your window in a buffer.

I tested this idea with the example below.  I needed to use a timer to give
the window time to hide before the Screen was captured.  This example just
copies what's underneath your window and dumps it into your window's client
area.  All you have to to is click on the window...


-- start of tested code --
include win32lib.ew

constant
  Win = create( Window, "Test Window", 0, Default, Default, 400, 400, 0 ),
  Buffer = create( Pixmap, "", Win, 0, 0, 0, 0, 0 ),
  PauseTimer = 1

------------------------------------------------------------

procedure onClick_Win()

  -- hide Window for capturing screen to Buffer
  setVisible( Win, False )
  -- pause to give time for window to hide
  setTimer( Win, PauseTimer, 100 )

end procedure
onClick[Win] = routine_id( "onClick_Win" )

------------------------------------------------------------

procedure onTimer_Win( integer timerID )
  sequence buffsize, winsize

  if timerID = PauseTimer then
    -- stop the timer
    killTimer( Win, PauseTimer )

    -- resize Buffer to same size as Window
    buffsize = getExtent( Win )
    setSize( Buffer, buffsize[1], buffsize[2] )

    -- copy screen to Buffer
    winsize = getSize( Win )
    bitBlt( Buffer, 0, 0, Screen, winsize[1],
            winsize[2], buffsize[1], buffsize[2], SrcCopy )

    -- show Window and copy Buffer to it
    setVisible( Win, True )
    copyBlt( Win, 0, 0, Buffer )
  end if

end procedure
onTimer[Win] = routine_id( "onTimer_Win" )

------- start --------
WinMain( Win, Normal )

-- end of tested code --

Hope this helps,
Brian

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu