1. setMousePointer bug

This is a multi-part message in MIME format.

--Boundary_(ID_WOHYqhfnhIjJ4i7bESTAjA)

i found a bug (using Don Phillips' VSplitter control) in setMousePointer() when
you set the mouse pointer to NULL or 0, the program crashes via kernel32.dll. go
a head try it, here's my code:

-- begin code
include win32lib.ew
without warning

constant Main = create( Window, "Left click or right Click to change pointer
(Right crashes!)", 0, Default, Default, .6, .6, 0 )

procedure onMouse_Main( integer event, integer x, integer y, integer shift )

     if event = LeftDown then
          setMousePointer( Main, SizeNSPointer )
     elsif event = RightDown then
          setMousePointer( Main, SizeWEPointer )
     elsif event = LeftUp then
          setMousePointer( Main, ArrowPointer )
     elsif event = RightUp then
          setMousePointer( Main, NULL )
     end if

end procedure
onMouse[ Main ] = routine_id( "onMouse_Main" )

WinMain( Main, Normal )
-- end code

An easy fix is to reset the pointer to ArrowPointer, but I would still like to
know, is this a Win32Lib error or relly a kernel32.dll error?

~Greg

--Boundary_(ID_WOHYqhfnhIjJ4i7bESTAjA)
Content-type: text/html; charset=iso-8859-1
Content-transfer-encoding: 7BIT

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>i found a bug (using Don Phillips' VSplitter 
control) in setMousePointer() when you set the mouse pointer to NULL or 0, the 
program crashes via kernel32.dll. go a head try it, here's my code:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>-- begin code</FONT></DIV>
<DIV><FONT face=Arial size=2>include win32lib.ew<BR>without warning</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>constant Main = create( Window, "Left click or 
right Click to change pointer (Right crashes!)", 0, Default, Default, .6, .6, 0 
)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>procedure onMouse_Main( integer event, integer x, 
integer y, integer shift )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;if event = LeftDown 
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; setMousePointer( Main,
SizeNSPointer )<BR>&nbsp;&nbsp;&nbsp; &nbsp;elsif event = RightDown 
then<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;setMousePointer( Main,
SizeWEPointer )<BR>&nbsp;&nbsp;&nbsp; &nbsp;elsif event = LeftUp 
then<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;setMousePointer( Main,
ArrowPointer )<BR>&nbsp;&nbsp;&nbsp; &nbsp;elsif event = RightUp 
then<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;setMousePointer( Main,
NULL )<BR>&nbsp;&nbsp;&nbsp; &nbsp;end if</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>end procedure<BR>onMouse[ Main ] = routine_id( 
"onMouse_Main" )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>WinMain( Main, Normal )</FONT></DIV>
<DIV><FONT face=Arial size=2>-- end code</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>An easy fix is to reset the pointer to 
ArrowPointer, but I would still like to know, i</FONT><FONT face=Arial size=2>s 
this a Win32Lib error or relly a kernel32.dll error?</FONT></DIV>
<DIV>&nbsp;</DIV>

--Boundary_(ID_WOHYqhfnhIjJ4i7bESTAjA)--

new topic     » topic index » view message » categorize

2. Re: setMousePointer bug

This was a mistake in win32lib. I have fixed it. In fact, there is a new routine
that might be of
use to you...

  procedure onMouse_Main( integer event, integer x, integer y, integer shift )
   
       if event = LeftDown then
            setMousePointer( Main, SizeNSPointer )
       elsif event = RightDown then
            setMousePointer( Main, SizeWEPointer )
       elsif event = LeftUp then
            restoreMousePointer( Main )
       elsif event = RightUp then
            restorePointer( Main)
       end if
   
  end procedure

How the library will work now is that each call to setMousePointer places the
existing pointer on a
stack. The restoreMousePointer call pops the stack thus restoring whatever was
the previous value.
In fact, a call to setMousePointer(x, NULL) will be equivalent to a call to
restoreMousePointer(x).

To avoid an issue with programs continually setting the pointer and never
restoring it, I've limited
the size of the mouse stack to 20 items. But generally speaking, each
setMousePointer call should
have a corresponding restoreMousePointer call. All pointers are automatically
restored when the
program closes.

19/09/2002 1:18:40 PM, g.haberek at comcast.net wrote:

>
>
>  To:     EUforum <EUforum at topica.com>
>
>  From:   g.haberek at comcast.net
>  Subject:setMousePointer bug
>  Date:   Wed, 18 Sep 2002 20:18:40 -0700
>
>
>
>  i found a bug (using Don Phillips' VSplitter control) in setMousePointer()
>  when you set the mouse pointer to NULL or 0, the program crashes via
>  kernel32.dll. go a head try it, here's my code:
>   
>
>  -- begin code
>  include win32lib.ew
>  without warning
>   
>  constant Main = create( Window, "Left click or right Click to change pointer
>
>  (Right crashes!)", 0, Default, Default, .6, .6, 0 )
>   
>  procedure onMouse_Main( integer event, integer x, integer y, integer shift )
>   
>       if event = LeftDown then
>            setMousePointer( Main, SizeNSPointer )
>
>       elsif event = RightDown then
>            setMousePointer( Main, SizeWEPointer )
>       elsif event = LeftUp then
>            setMousePointer( Main, ArrowPointer )
>
>       elsif event = RightUp then
>            setMousePointer( Main, NULL )
>       end if
>   
>  end procedure
>
>  onMouse[ Main ] = routine_id( "onMouse_Main" )
>   
>  WinMain( Main, Normal )
>  -- end code
>   
>  An easy fix is to reset the pointer to ArrowPointer, but I would still like
>
>  to know, is this a Win32Lib error or relly a kernel32.dll error?
>   
>  ~Greg
>
>
>
>
>
---------
Cheers,
Derek Parnell 
ICQ# 7647806

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

3. Re: setMousePointer bug

thanks for the head's up. BTW, that bug was also crashing Judith's IDE, 
and I kept losing programs! I guess I'll d/l the new win32lib now...

thanks again
~Greg



----- Original Message -----
From: Derek Parnell <ddparnell at bigpond.com>
Date: Wednesday, September 18, 2002 8:55 pm
Subject: Re: setMousePointer bug

> 
> This was a mistake in win32lib. I have fixed it. In fact, there is 
> a new routine that might be of 
> use to you...
> 
>  procedure onMouse_Main( integer event, integer x, integer y, 
> integer shift )
>   
>       if event = LeftDown then
>            setMousePointer( Main, SizeNSPointer )
>       elsif event = RightDown then
>            setMousePointer( Main, SizeWEPointer )
>       elsif event = LeftUp then
>            restoreMousePointer( Main )
>       elsif event = RightUp then
>            restorePointer( Main)
>       end if
>   
>  end procedure
> 
> How the library will work now is that each call to setMousePointer 
> places the existing pointer on a 
> stack. The restoreMousePointer call pops the stack thus restoring 
> whatever was the previous value. 
> In fact, a call to setMousePointer(x, NULL) will be equivalent to 
> a call to restoreMousePointer(x).
> 
> To avoid an issue with programs continually setting the pointer 
> and never restoring it, I've limited 
> the size of the mouse stack to 20 items. But generally speaking, 
> each setMousePointer call should 
> have a corresponding restoreMousePointer call. All pointers are 
> automatically restored when the 
> program closes.
> 
> 19/09/2002 1:18:40 PM, g.haberek at comcast.net wrote:
> 
> >
> >  To:     EUforum <EUforum at topica.com>
> >
> >  From:   g.haberek at comcast.net
> >  Subject:setMousePointer bug
> >  Date:   Wed, 18 Sep 2002 20:18:40 -0700
> >
> >
> >  i found a bug (using Don Phillips' VSplitter control) in 
> setMousePointer()>  when you set the mouse pointer to NULL or 0, 
> the program crashes via
> >  kernel32.dll. go a head try it, here's my code:
> >   
> >
> >  -- begin code
> >  include win32lib.ew
> >  without warning
> >   
> >  constant Main = create( Window, "Left click or right Click to 
> change pointer
> >
> >  (Right crashes!)", 0, Default, Default, .6, .6, 0 )
> >   
> >  procedure onMouse_Main( integer event, integer x, integer y, 
> integer shift )
> >   
> >       if event = LeftDown then
> >            setMousePointer( Main, SizeNSPointer )
> >
> >       elsif event = RightDown then
> >            setMousePointer( Main, SizeWEPointer )
> >       elsif event = LeftUp then
> >            setMousePointer( Main, ArrowPointer )
> >
> >       elsif event = RightUp then
> >            setMousePointer( Main, NULL )
> >       end if
> >   
> >  end procedure
> >
> >  onMouse[ Main ] = routine_id( "onMouse_Main" )
> >   
> >  WinMain( Main, Normal )
> >  -- end code
> >   
> >  An easy fix is to reset the pointer to ArrowPointer, but I 
> would still like
> >
> >  to know, is this a Win32Lib error or relly a kernel32.dll error?
> >   
> >  ~Greg
> >
> >
> ---------
> Cheers,
> Derek Parnell 
> ICQ# 7647806
> 
> 
> 
> 
<snip>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu