Re: Help! GPF
- Posted by David Cuny <dcuny at LANSET.COM> Aug 04, 1999
- 485 views
I *think* I'm making a bit of progress on the GPF, but I'm not sure. Here's what I know and suspect so far. The event names are approximate; I'm going by memory. Win32Lib is happily chugging along, processing Window events that are associated with painting the controls - WM_ERASEBKGND and WM_COLORCNGSTATIC; that sort of thing. Nothing unusual at all. Controls are popping up in the window as they should. Then one of the menu items gets a WM_PAINT event. Huh? I didn't think menu items got paint events. Besides, the paint event should belong to the next ordinal control, not a menu item. So this looks suspicious. Win32Lib tries to let the menu item's default handler routine take care of the WM_PAINT event, calling the stored default event handler. But I'm not even sure that a menu item *has* a default event handler routine stored - there's probably a zero for a value. Win32Lib never returns from the call to the c_func() - I think this is where it goes off to la-la land. The next event is a WM_CANCELSTATE event. This event is triggered when Windows is about to take away focus from a window, and gives the application or control a chance to gracefully drop the mouse if it's done a modal grab. This is usually issued just before popping up a modal dialog box. This is followed by a WM_LOSTFOCUS as the window loses focus, and at this point, I think that Windows is putting up the dialog box displaying the GPF information. Focus returns to the window with a WM_GOTFOCUS, and from that point on, the only event being processed is the WM_PAINT event, aimed at the same menu item: WM_PAINT WM_PAINT WM_PAINT etc. My guess is that, for some unknown reason, Win32Lib is somehow mis-identifying the control that the handle is associated with, and pointing to the menu item instead. I'm not sure how that could be happening, since it just does a find() on a list of handles. Why is this happening? I don't know. Maybe it has something to do with the events taking place outside the WinMain loop; maybe I've done something really stupid; maybe I'm entirely on the wrong track. Hopefully I'll have better answers later. -- David Cuny