Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. What am I doing wrong?

What am I doing wrong?

Scheduled Pinned Locked Moved C / C++ / MFC
question
25 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F FISH786

    I just created a new project and using the default setting... I still don't get the nresponse..

    BOOL CToolApp::InitInstance()
    CToolDlg dlg;
    m_pMainWnd = &dlg;
    INT_PTR nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
    // TODO: Place code here to handle when the dialog is
    // dismissed with OK
    MessageBox(NULL,"It Works Now","Information",MB_OK);
    }
    else if (nResponse == IDCANCEL)
    {
    // TODO: Place code here to handle when the dialog is
    // dismissed with Cancel
    }
    {

    I left the CToolDlg as default..I din't put any code and just clicked the ok button. I don't get a response back.

    S Offline
    S Offline
    Stuart Dootson
    wrote on last edited by
    #11

    Sounds like there's something wrong with your system, then - I just tried the very same thing and it returned 1 (IDOK) as expected when I pressed the OK button.

    Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

    F E 2 Replies Last reply
    0
    • S Stuart Dootson

      Sounds like there's something wrong with your system, then - I just tried the very same thing and it returned 1 (IDOK) as expected when I pressed the OK button.

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      F Offline
      F Offline
      FISH786
      wrote on last edited by
      #12

      Wow, Do I re-install to fix it? Or is there something I should try before re-installing?

      S 1 Reply Last reply
      0
      • F FISH786

        Wow, Do I re-install to fix it? Or is there something I should try before re-installing?

        S Offline
        S Offline
        Stuart Dootson
        wrote on last edited by
        #13

        Single-step through the MFC source code of the CDialog::DoModal call. That should let you see what happens in and after the modal message loop.

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        F 1 Reply Last reply
        0
        • S Stuart Dootson

          Sounds like there's something wrong with your system, then - I just tried the very same thing and it returned 1 (IDOK) as expected when I pressed the OK button.

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          E Offline
          E Offline
          Eytukan
          wrote on last edited by
          #14

          Stuart Dootson wrote:

          Sounds like there's something wrong with your system

          At last there's a reason for those bunch of tree huging hippy testers to be happy!. A support to their slogan.

          Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.

          1 Reply Last reply
          0
          • S Stuart Dootson

            Single-step through the MFC source code of the CDialog::DoModal call. That should let you see what happens in and after the modal message loop.

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

            F Offline
            F Offline
            FISH786
            wrote on last edited by
            #15

            I did single step...I do see nResponse comming back as 1. However it's just jumping the whole if block and going straight to return FALSE. This is with just plain project no code anywhere except a message box inside the

            if (nResponse == IDOK)
            {
            MessageBox();
            }
            else if (nResponse == IDCANCEL)
            {
            }
            It's jumping this whole block.

            it going to return FALSE; the follwing is what I get at the end of the steping through.

            'Tool.exe': Loaded 'C:\WINDOWS\system32\imm32.dll'
            'Tool.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll'
            'Tool.exe': Loaded 'C:\WINDOWS\system32\shell32.dll'
            'Tool.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll'
            'Tool.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.MFCLOC_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_b0db7d03\mfc90enu.dll', Binary was not built with debug information.
            'Tool.exe': Loaded 'C:\WINDOWS\system32\msctf.dll'
            'Tool.exe': Loaded 'C:\WINDOWS\system32\version.dll'
            'Tool.exe': Unloaded 'C:\WINDOWS\system32\version.dll'
            'Tool.exe': Loaded 'C:\WINDOWS\system32\msctfime.ime'
            The program '[976] Tool.exe: Native' has exited with code 0 (0x0).

            However I did an uninstall of the update of Internet Explorer that was done on this machine a week ago. I am Running Visual Studio 2008 Version 9.0.30729.1 SP Not sure if the above info makes any difference?

            S 1 Reply Last reply
            0
            • F FISH786

              I did single step...I do see nResponse comming back as 1. However it's just jumping the whole if block and going straight to return FALSE. This is with just plain project no code anywhere except a message box inside the

              if (nResponse == IDOK)
              {
              MessageBox();
              }
              else if (nResponse == IDCANCEL)
              {
              }
              It's jumping this whole block.

              it going to return FALSE; the follwing is what I get at the end of the steping through.

              'Tool.exe': Loaded 'C:\WINDOWS\system32\imm32.dll'
              'Tool.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll'
              'Tool.exe': Loaded 'C:\WINDOWS\system32\shell32.dll'
              'Tool.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll'
              'Tool.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.MFCLOC_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_b0db7d03\mfc90enu.dll', Binary was not built with debug information.
              'Tool.exe': Loaded 'C:\WINDOWS\system32\msctf.dll'
              'Tool.exe': Loaded 'C:\WINDOWS\system32\version.dll'
              'Tool.exe': Unloaded 'C:\WINDOWS\system32\version.dll'
              'Tool.exe': Loaded 'C:\WINDOWS\system32\msctfime.ime'
              The program '[976] Tool.exe: Native' has exited with code 0 (0x0).

              However I did an uninstall of the update of Internet Explorer that was done on this machine a week ago. I am Running Visual Studio 2008 Version 9.0.30729.1 SP Not sure if the above info makes any difference?

              S Offline
              S Offline
              Stuart Dootson
              wrote on last edited by
              #16

              FISH786 wrote:

              if (nResponse == IDOK) { MessageBox(); } else if (nResponse == IDCANCEL) { } It's jumping this whole block.

              I'm surprised that it doesn't execute the messagebox - VC++ will (even in Debug mode) optimise away a completely empty if...else... statement

              Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

              F 1 Reply Last reply
              0
              • S Stuart Dootson

                FISH786 wrote:

                if (nResponse == IDOK) { MessageBox(); } else if (nResponse == IDCANCEL) { } It's jumping this whole block.

                I'm surprised that it doesn't execute the messagebox - VC++ will (even in Debug mode) optimise away a completely empty if...else... statement

                Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                F Offline
                F Offline
                FISH786
                wrote on last edited by
                #17

                Well is there a way I can work around it?, I guess reinstalling is not going to help either? Quick question are you running the same version of Visual studio 2008? Could you let me know what version you running? I could uninstall 2008 and revert back to 2005 if I have to? Thanks a million.

                S 1 Reply Last reply
                0
                • F FISH786

                  Well is there a way I can work around it?, I guess reinstalling is not going to help either? Quick question are you running the same version of Visual studio 2008? Could you let me know what version you running? I could uninstall 2008 and revert back to 2005 if I have to? Thanks a million.

                  S Offline
                  S Offline
                  Stuart Dootson
                  wrote on last edited by
                  #18

                  FISH786 wrote:

                  Quick question are you running the same version of Visual studio 2008?

                  VS2008 SP1

                  FISH786 wrote:

                  I could uninstall 2008 and revert back to 2005 if I have to?

                  I don't there's a problem with your installation from what you've written - what you've said indicates that the right thing's being returned. Why doesn't that translate back into your code? Not sure.

                  Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                  F 1 Reply Last reply
                  0
                  • S Stuart Dootson

                    FISH786 wrote:

                    Quick question are you running the same version of Visual studio 2008?

                    VS2008 SP1

                    FISH786 wrote:

                    I could uninstall 2008 and revert back to 2005 if I have to?

                    I don't there's a problem with your installation from what you've written - what you've said indicates that the right thing's being returned. Why doesn't that translate back into your code? Not sure.

                    Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                    F Offline
                    F Offline
                    FISH786
                    wrote on last edited by
                    #19

                    Any suggetions as to how I could resolve this? Thanks a million

                    S 1 Reply Last reply
                    0
                    • F FISH786

                      Any suggetions as to how I could resolve this? Thanks a million

                      S Offline
                      S Offline
                      Stuart Dootson
                      wrote on last edited by
                      #20

                      By debugging your code and working out why your code's not getting called when it should be. If that means debugging assembly language, then that's what you need to do.

                      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                      F 1 Reply Last reply
                      0
                      • S Stuart Dootson

                        By debugging your code and working out why your code's not getting called when it should be. If that means debugging assembly language, then that's what you need to do.

                        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                        F Offline
                        F Offline
                        FISH786
                        wrote on last edited by
                        #21

                        I am not sure what to say, I just installed VS on a different machine and I get the same thing, no message box. I used a full install. Thanks

                        S 1 Reply Last reply
                        0
                        • F FISH786

                          I am not sure what to say, I just installed VS on a different machine and I get the same thing, no message box. I used a full install. Thanks

                          S Offline
                          S Offline
                          Stuart Dootson
                          wrote on last edited by
                          #22

                          Which says there's something not quite right with your code, not your Visual Studio install. Debugging's the way forward in this case, I'm afraid.

                          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                          F 1 Reply Last reply
                          0
                          • S Stuart Dootson

                            Which says there's something not quite right with your code, not your Visual Studio install. Debugging's the way forward in this case, I'm afraid.

                            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                            F Offline
                            F Offline
                            FISH786
                            wrote on last edited by
                            #23

                            Hello there, Found it. This should have not been used, when I am verifying the key to the main app. m_pMainWnd = &dlg; Thanks a lot for all your help.

                            S 1 Reply Last reply
                            0
                            • F FISH786

                              Hello there, Found it. This should have not been used, when I am verifying the key to the main app. m_pMainWnd = &dlg; Thanks a lot for all your help.

                              S Offline
                              S Offline
                              Stuart Dootson
                              wrote on last edited by
                              #24

                              Well done - I'm glad you found the problem.

                              Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                              F 1 Reply Last reply
                              0
                              • S Stuart Dootson

                                Well done - I'm glad you found the problem.

                                Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                                F Offline
                                F Offline
                                FISH786
                                wrote on last edited by
                                #25

                                Thank you.

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups