Re: getSelf( )
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Sep 14, 2000
- 395 views
> -----Original Message----- > From: Cuny, David@DSS > > > I don't think that's correct, because windows > > (and win32lib) will handle that message before > > returning to onSomeEvent(). So the stack should > > be popped by then, right? > > Run the example, and I think you'll see that there's still a bug. > > -- David Cuny > I agree with you, there is a bug, but there seems to be a much simpler solution than what Derek proposes (especially since it doesn't address the root of the problem :). The getSelf() problem arises when WM_CTLCOLORBUTTON or WM_CTLCOLORSTATIC messages are sent. Win32Lib returns the handle to the brush, but never pops the stack. If you add an "if popSelf() then end if" at about line 17182, right before return c_func( xGetClassLong, {getHandle(id), GCL_HBRBACKGROUND} ) the problem is fixed. You'll need to do the same thing in SubProc, on line 17644 or so. Oh, and in the WM_NOTIFY section in SubProc, lines 17694 and 17697. I guess this is a good time to let everyone know that whenever you add a return statement to WndProc or SubProc, you have to pop the stack. Now Dave's little example will run as expected. Matt