1. need help finding bug (win32)

I am still working on my first Euphoria program and I have found a
puzzling bug.  I am using copyBlt to capture and redraw the window in this
program but my program occasionally captures windows that are placed on
top of it.

The source code requires the latest win32lib.ew to run and can be
downloaded from http://cnw.com/~bkb/WinLine.exw (case sensitive) and an
example screenshot of my problem can found at
http://cnw.com/~bkb/linewin.jpg

This is a work in progress...

Also, if you uncomment the onOpen_LineWin procedure, you can see that the
entire window becomes a screen capture when first executed.

Thanks in advance...
Brian

new topic     » topic index » view message » categorize

2. Re: need help finding bug (win32)

Brian Broker wondered:

> I am using copyBlt to capture and redraw
> the window in this program but my program
> occasionally captures windows that are placed
> on top of it.

Here's the main problem:

   procedure onMouse_LineWin( integer event, integer x, integer y )
     integer paintsize
     sequence extent

     if event = LEFT_DOWN or event = RIGHT_DOWN then
        <snip>
     end if

     copyBlt( Buffer, 0, 0, LineWin )

   end procedure
   onMouse[LineWin] = routine_id("onMouse_LineWin")

The onMouse code is triggered whenever there is *any* kind of mouse movement
over the window. So if another window pops up in front of LineWin, and you
move your mouse over LineWin, you've copied the overlaid window.

There is another problem - if the user resizes the window, Buffer may not be
large enough to hold the image. You probably want to stick some logic in to
handle that - probably with onResize.

I'd suggest perhaps drawing using double-buffering. Draw to the off-screen
Buffer, and the CopyBlt that to LineWin. If that's jerky, you might have to
keep track of the area you "damaged" drawing to Buffer, and only copy that.
It's a bit more work, but will probably make the end result a lot smoother.

-- David Cuny

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

3. Re: need help finding bug (win32)

Thanks David (I figured you'd be the one to come to my rescue.)  Moving
the copyBlt into the "if event = LEFT_DOWN..." fixes my problem.  I will
probably be implementing your double buffering suggestion but I thought
I'd share the problem in case it wasn't my fault.  I just have to make
sure I stick new code into the right places... 8^)

On Wed, 28 Jul 1999, Cuny, David wrote:

>    procedure onMouse_LineWin( integer event, integer x, integer y )
>      integer paintsize
>      sequence extent
>
>      if event = LEFT_DOWN or event = RIGHT_DOWN then
>         <snip>
>
>      copyBlt( Buffer, 0, 0, LineWin )
>
>>>    end if
>    end procedure
>    onMouse[LineWin] = routine_id("onMouse_LineWin")
>

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

4. Re: need help finding bug (win32)

Why don't you use a dragging rectangle ( rubber banding )on the screen
to outline the area you want to capture then when the user wants to
capture all he does is right click mouse key. Using this method your
user is not opening or poping any windows becaue they are concentrating
on the rubberbanding rectangle.
Berine

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

5. Re: need help finding bug (win32)

The whole purpose of capturing the screen's contents is so that a user can
do something else while the app is running but they can come back to it
where they left off (pattern is still in tact).  Without the buffer, other
windows dragged over my app would erase it's contents.
I plan to further develop this app as a means of getting my feet wet using
Euphoria to do Windows programming.  I've still got a few neat ideas for
this one (and I'll probably be rewriting stuff as I go...)

...but thanks for the idea...
Brian

On Wed, 28 Jul 1999, Bernie Ryan wrote:

> Why don't you use a dragging rectangle ( rubber banding )on the screen
> to outline the area you want to capture then when the user wants to
> capture all he does is right click mouse key. Using this method your
> user is not opening or poping any windows becaue they are concentrating
> on the rubberbanding rectangle.
> Berine
>

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

6. Re: need help finding bug (win32)

Why not just save the screen to the clipboard and then grab it from there
using dde.
bernie

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

Search



Quick Links

User menu

Not signed in.

Misc Menu