Thread: MSVC 2003 break point problem

  1. #1
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396

    MSVC 2003 break point problem

    I have run across a problem trying to use break points in MSVS 2003 to debug my code. I don't see anything wrong with my code and the debugger says MBRet = 7 and it also says IDNO = 7. Anyway when I try to step through my code these lines are skipped:
    Code:
    if (MBRet == IDNO)
    {
         WC.bFileNeedsSaved == false;
    }
    Just for kicks heres is the function I am using the return value of:
    Code:
    int AskAboutSave (HWND hwnd)
    {
        int iReturn = NULL;
    
        iReturn = MessageBox (NULL, "Save current changes?", szAppName, MB_YESNOCANCEL);
        if(iReturn == IDYES)
        {
            SendMessage(hwnd, WM_COMMAND, ID_FRAME_SAVE, 0);
        }
        return iReturn ;
    I have tried 'cleaning' the solution but no change. I really don't see anything wrong with this code!

    Here is the code where Visual Studio just deletes my break points and skips the code.

    Anyone ever seen anything like this?
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    1. check that you do not have any optimization enabled
    2. try to clean and rebuild all
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Update I have done what you suggested and even rebooted.

    Here is another part of my code that reuses this function and it allows me to step through just fine:
    Code:
        case WM_CLOSE :
            if(WC.bFileNeedsSaved)
            {
                test = AskAboutSave(hwnd);
    
    
                if (test == IDCANCEL)
                {
                    return 0;
                }
                else if (test == IDYES)
                {
                    SendMessage(hwnd, WM_COMMAND, ID_FRAME_SAVE, 0);
                }
                else if (test == IDNO)
                {
                    MessageBox(hwnd,"test","test",IDOK);
                }
            }
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  4. #4
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    I even rebuilt the project on another pc to the save effect. It still wont let me debug the ID_FRAME_NEW case.

    I am at a loss here. What else can I do besides a clean rebuild?
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  5. #5
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    I finally found a somewhat related link that suggests reinstalling MSVC but since I have the exact problem on a different PC I can't see how this could fix it and that's a pain in the butt!
    Still Googling hopefully I'll find an answer.
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  6. #6
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    After closer inspection of this line of code...
    Code:
    WC.bFileNeedsSaved == false;
    Well I feel like an idiot maybe I shouldn't try programming until 2:30 in the morning.




    The only reason I caught the mistake is because I retyped it without cut and paste! Walla, I didn't make the same typo.
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    I see the current line of code jump around alot in MSVC 2003, especially when using exception handlers (try/catch)

    It often looks like it hit the last line of the method and then jumps back to the last line of the catch().
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help it won't compile!!!!!
    By esbo in forum C Programming
    Replies: 58
    Last Post: 01-04-2009, 03:22 PM
  2. A Full Program to analyze.
    By sergioms in forum C Programming
    Replies: 2
    Last Post: 12-30-2008, 09:42 AM
  3. Keypress reading
    By geek@02 in forum Windows Programming
    Replies: 1
    Last Post: 06-16-2004, 12:16 PM
  4. Extra printed stmts...why?
    By mangoz in forum C Programming
    Replies: 4
    Last Post: 12-19-2001, 07:56 AM
  5. A simple array question
    By frenchfry164 in forum C++ Programming
    Replies: 7
    Last Post: 11-25-2001, 04:13 PM