Odd Dialog creation... when deleting unused line of code - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22

Thread: Odd Dialog creation... when deleting unused line of code

  1. #16
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,093

    Re: Odd Dialog creation... when deleting unused line of code

    You've stepped through all the dialog creation code, constructors, Create call, OnInitDialog, etc. to see why it's getting placed where it's getting placed I assume?

  2. #17
    Join Date
    May 2009
    Posts
    103

    Re: Odd Dialog creation... when deleting unused line of code

    Thanks for getting back to me so fast...

    Yes, we can step through all the code without a problem. When we run it in the IDE, it works fine. When we compile it and run the EXE, it moves the dialog to the corner.

    What I think I need to do.... I need to create a log file that will run in the EXE and "write" out at certain places the value of ???? to watch for when it changes. I am thinking with that, I can narrow down the section of code that may have the issue(s) for now. Problem is, because we don't specifically address the dialogs creation location... I am not 100% sure where it gets the default positioning info from that it uses.

    Right track, wrong track????? At this point and way too much time going after this problem... I am at a loss. I need to make some other fixes to the program but don't want to lose my "repeatable" error.

    Thanks again...

  3. #18
    Join Date
    Apr 1999
    Posts
    27,427

    Re: Odd Dialog creation... when deleting unused line of code

    So, I have to ask again, any more suggestions/recommendations?
    Unless you give us the code to debug, everything that has been stated to you is what anyone here would have done already.

    It's simple -- a dialog is placed at an X,Y position on the screen. There is only one way to do that, regardless of the layers of MFC or code. The dialog template that is being read by the Windows OS to position the dialog is either incorrect or corrupted. There is no other way for a dialog to show up on the screen in a certain position (if you claim you had no control over the dialog).
    Even had another experienced C++ programmer look at the code
    And these experienced C++ programmers cannot solve a problem that is easily duplicated at startup?

    Regards,

    Paul McKenzie

  4. #19
    Join Date
    Apr 1999
    Posts
    27,427

    Re: Odd Dialog creation... when deleting unused line of code

    Quote Originally Posted by pbrama View Post
    Problem is, because we don't specifically address the dialogs creation location... I am not 100% sure where it gets the default positioning info from that it uses.
    How is this dialog created? If it is created via resource ID, then look at the .rc file. That is where the position of the dialog is established.

    Regards,

    Paul McKenzie

  5. #20
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,093

    Re: Odd Dialog creation... when deleting unused line of code

    Quote Originally Posted by pbrama View Post
    Thanks for getting back to me so fast...

    Yes, we can step through all the code without a problem. When we run it in the IDE, it works fine. When we compile it and run the EXE, it moves the dialog to the corner.

    What I think I need to do.... I need to create a log file that will run in the EXE and "write" out at certain places the value of ???? to watch for when it changes. I am thinking with that, I can narrow down the section of code that may have the issue(s) for now. Problem is, because we don't specifically address the dialogs creation location... I am not 100% sure where it gets the default positioning info from that it uses.

    Right track, wrong track????? At this point and way too much time going after this problem... I am at a loss. I need to make some other fixes to the program but don't want to lose my "repeatable" error.

    Thanks again...
    You could try building a release version with debug info in it and debugging and see if you can reproduce the problem. You could always add CenterWindow in OnInitDialog, but you could potentially hide another problem by doing that.

  6. #21
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,634

    Re: Odd Dialog creation... when deleting unused line of code

    Have you tried rearranging the variables (shuffle the variables around m_bFlag)? With a bit of luck it might produce something that's easier to detect like a access violation. It's been a long time since I used VC6 but I guess that it's capable to attach to the exe when (if) it has crashed?

    If your budget doesn't allow for Boundschecker or somthing similar it might allow for pc-lint (http://www.gimpel.com/html/index.htm). I've used it in many projects and it's quite good in finding suspicious areas of the code.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  7. #22
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,526

    Re: Odd Dialog creation... when deleting unused line of code

    Quote Originally Posted by pbrama View Post
    ...When we run it in the IDE, it works fine. When we compile it and run the EXE, it moves the dialog to the corner.
    When you run it "in the IDE", you are still running the compiled and linked executable.
    Are you saying that the same exe file that runs OK from IDE behaves differently when simply double-clicked from Explorer?
    Or are you talking about the differences between Debug and Release configurations?
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, and more...

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center