BCB Program Execution Going Wonky


2004-08-07 09:21:47 AM
cppbuilder88
Hi,
I have written a simple app that was compiled with BCB3 and runs fine on
Win98Se. However it locks and crashes on XP. I realize that BCB3 is not
supported on XP but I've written other apps which work on XP no problem. I
have narrowed it down to the following point: running it on XP, the program
reaches the 'breakpoint c' message box and then leaves the current function
and jumps to another function that was called 40 lines back!! Both this
function block and the one it jumps to, are private member functions of the
main form class. Is it the FillRect function that is wonky on XP the way
I've used it?? or does this sound like I'm overwriting some memory where I
shouldn't be. The program is consistent in that each time I've run it on XP,
it passes breakpoint-c and then jumps out to the other function again.
Here's the code snippet:
// calc origin and dimensions of input echo canvas
Application->MessageBox("BREAKPOINT-0", "Breakpoint",
MB_OK|MB_ICONEXCLAMATION);
inXorigin = 0;
inYorigin = 0;
// InputEcho is a TImage that has its dimensions set at design-time
// I've checked the top,left,width and height values at runtime on the
// XP machine via message box and they are reasonable and correct
incvWidth = InputEcho->Width;
incvHeight = InputEcho->Height;
Application->MessageBox("BREAKPOINT-1", "Breakpoint",
MB_OK|MB_ICONEXCLAMATION);
// paint canvas white before redrawing
TColor origcolor = InputEcho->Canvas->Brush->Color;
Application->MessageBox("BREAKPOINT-a", "Breakpoint",
MB_OK|MB_ICONEXCLAMATION);
InputEcho->Canvas->Brush->Color = clWhite;
Application->MessageBox("BREAKPOINT-b", "Breakpoint",
MB_OK|MB_ICONEXCLAMATION);
TRect r = Rect(inXorigin,inYorigin,incvWidth,incvHeight);
Application->MessageBox("BREAKPOINT-c", "Breakpoint",
MB_OK|MB_ICONEXCLAMATION);
InputEcho->Canvas->FillRect(r);
// execution never reaches this point!!!!!
Application->MessageBox("BREAKPOINT-d", "Breakpoint",
MB_OK|MB_ICONEXCLAMATION);
InputEcho->Canvas->Brush->Color = origcolor;