Re: How to debug a compiled exe

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Ralph,

thanks for keeping me from totally rebuilding my app! I killed all DoEvents and replaced them with Sleep where necessary.
My problem was that I was doing long doevent loops in which the app could do other things that it wanted to do.
And so it do. My killer bug was the following:

On frmMain I have a usercontrol which draws a gridlike graphical interface.
You can click on a cell in the grid, and the grid will change. The grid will be built offscreen and then scrolled over the old grid surface. To slow down the scrolling I used DoEvents. While it was still scrolling, I closed the main form.
In main form's QueryUnload I said "Unload frmContainer".
frmContainer however holds a custom image list that the grid control on the main form uses to draw graphics.

What happened? frmContainer was unloaded, but the grid was still scrolling. Okay, there where no graphics drawn anymore because everything was already drawn, but at the end of the scrolling, the main form's size may be changed (caused by the previous click on the cell which caused the scrolling as well)). So now the graphics have scrolled to it's final position and the resize event is called. This causes frmMain to resize although it was queried to be unloaded.
The resize event causes the grid to be redrawn again... well, event if frmMain was unloaded, frmContainer is still loaded (again) because it was asked to use its image control to draw on the grid.
When I installed my exception handler, I could see a lot going on that was unexpected, mainly subclassing.

With doevents still all around my code and having the runtime exception handler installed, my main app window was gone, but my app still hanging in the taskmanager (because of frmContainer not being unloaded).

When I killed all doevents and replaced them with sleep, everything happened "in a fixed chain":
I clicked on a cell, the grid was redrawn and was scrolling in. While it was scrolling it, I clicked on the close button of frmMain. Unlike before, it had no immediate effect this time because my app wouldn't let me react yet (it was still busy scrolling). When scrolling was finished, the main window resized. Only after that it reacted on my close-button click, and unloaded cleanly.

LOL. I don't know if anybody really reads this but I wanted to expose my path of suffering somewhere :-)
.



Relevant Pages

  • Re: APP behaves differently in IDE vs EXE
    ... The app is using the dbgrid32 control as an unbound grid. ... Since I've added the line to set the bookmark property to ... scrolling issue, I'd appreciate hearing them. ...
    (microsoft.public.vb.general.discussion)
  • Re: TStringGrid.DrawCell - Not Updating The Correct Cell
    ... Instead of scrolling the visible grid I scrolled the invisible grid ... By telling it to refresh all the cells you are generating quite a lot ... This message sets or clears the redraw flag. ...
    (comp.lang.pascal.delphi.misc)
  • Re: SplitScreen
    ... that uses PictureBox controls for the divider bars, ... eliminates a few controls. ... A question on the synchronized scrolling - it appears that a FlexGrid will ... I want to use a single scrollbar (on grid 3) without others showing ...
    (microsoft.public.vb.controls)
  • Re: MSHFlexGrid not scrolling beyond 65,535 rows - see Q253211. Any fix?
    ... of the data in the grid at any one time. ... underlying the recordset but with different criteria, ... It has nothing to do with recollection like some Mr Memory game. ... dataset is if it is unordered by scrolling thru entries manually from ...
    (microsoft.public.vb.general.discussion)
  • Re: MSHFlexGrid not scrolling beyond 65,535 rows - see Q253211. Any fix?
    ... And, if it is, then you only need a very much smaller subset of the data in the grid at any one time. ... a bookmark to mark certain rows or ranges of rows then do a sort to ... underlying the recordset but with different criteria, ... The user, unless intimately familiar w/ the data set, certainly isn't going to be able to find what the range of any particular value in a dataset is if it is unordered by scrolling thru entries manually from top to bottom trying to make sure they find the largest and don't miss a bigger one on the way down meanwhile the same thing for smallers and any other corollary variables they're interested in. ...
    (microsoft.public.vb.general.discussion)