February 26th, 2013, 08:47 PM
Odd Dialog creation... when deleting unused line of code
I ran into a very weird problem and after a lot of trial error, narrowed it down to a single line of code that should NOT be causing this problem...
A little background....
We have a very very large VC6 program that was written and modified by several programmers over the past 10+ years. One of the first things that the program does when it runs for the first time, is display a small dialog box centered on the display for some basic input. This dialog is a small subclass of the CDialog class. The subclass changes are very minimal, mostly just process the input results.
I recently removed a section of code and some variable declarations that are no longer used. When the program EXE was "run", this dialog no longer appears centered, it is now in the lower right corner. If I run the program in the VC6 development environment, the dialog appears as normal. For clarification, the subclass does not control any of the dialog positioning whatsoever.
Restoring the removed code and then via trial and error, removing each line individually, recompiling and executing the EXE, I have narrowed it down to a single line of code. Keeping the line, the dialog appears as anticipated. Removing it, the dialog moves to the corner.
This line of code is as follows:
This line of code is in the .h for the subclass, in the protected section of the declaration. This m_bFlag variable is no longer referenced or used anywhere in the program except for this line. Of course, not being able to replicate this in the development environment makes it even harder to diagnose.
Of course, I could just leave this line in place and ignore it... but that is NOT a solution as I can see it. What worries me even worse is this may be just a symptom of a larger problem... guessing, maybe possible memory issue or ????? I've never had an issue with REMOVING a variable declaration unless that variable is used, which it is not... that's what makes this so bizarre.
Any suggestions or ideas that may point me in the right direction for fixing this issue, would be greatly appreciated....
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!