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. AfxMessageBox stop working after split the frame

AfxMessageBox stop working after split the frame

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
7 Posts 2 Posters 0 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.
  • G Offline
    G Offline
    gurucplusplus
    wrote on last edited by
    #1

    I have a SDI application in MFC. I split the main frame to 2 rows and 1 columm, then further split first row of the main frame to 1 row and 2 columns statically. the following code is added to OnCreateClient(). // split main frame m_mainSplitterFrame.CreateStatic(this,2,1); // further split top main frame to one row and 2 columns m_childSplitterFrame.CreateStatic(&m_mainSplitterFrame,2,1, WS_CHILD | WS_VISISBLE,m_mainSpitterFrame.IdFromColRow(0,0)); //Create view for sub frame m_childSplitterFrame.CreateView(0,0,RUNTIME_CLASS(CMyChildView),CSize(100,100),pContext); m_childSplitterFrame.CreateView(0,1,RUNTIME_CLASS(CMyChildView),CSize(100,100),pContext); // create bottom view m_mainSplitterFrame.createView(1,0,RUNTIME_CLASS(CMyMainView),CSize(100,100),pcontext); retrun TRUE; After I execute my program, all of my AfxMessageBox used to display in SDI frame now hang my program. Help!!!!!

    D 1 Reply Last reply
    0
    • G gurucplusplus

      I have a SDI application in MFC. I split the main frame to 2 rows and 1 columm, then further split first row of the main frame to 1 row and 2 columns statically. the following code is added to OnCreateClient(). // split main frame m_mainSplitterFrame.CreateStatic(this,2,1); // further split top main frame to one row and 2 columns m_childSplitterFrame.CreateStatic(&m_mainSplitterFrame,2,1, WS_CHILD | WS_VISISBLE,m_mainSpitterFrame.IdFromColRow(0,0)); //Create view for sub frame m_childSplitterFrame.CreateView(0,0,RUNTIME_CLASS(CMyChildView),CSize(100,100),pContext); m_childSplitterFrame.CreateView(0,1,RUNTIME_CLASS(CMyChildView),CSize(100,100),pContext); // create bottom view m_mainSplitterFrame.createView(1,0,RUNTIME_CLASS(CMyMainView),CSize(100,100),pcontext); retrun TRUE; After I execute my program, all of my AfxMessageBox used to display in SDI frame now hang my program. Help!!!!!

      D Offline
      D Offline
      Demian Panello
      wrote on last edited by
      #2

      That's weird:doh: Tell me something, what you mean with "hang"? Freezing?, or it throws an assertion?. Because I think it's a little bit strange that issue. And, since when the program started to "hang"?.

      Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

      G 1 Reply Last reply
      0
      • D Demian Panello

        That's weird:doh: Tell me something, what you mean with "hang"? Freezing?, or it throws an assertion?. Because I think it's a little bit strange that issue. And, since when the program started to "hang"?.

        Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

        G Offline
        G Offline
        gurucplusplus
        wrote on last edited by
        #3

        Hang to me means the window application never come back and I can not access to any menu in main frame. The progam didn't throw an exception otherwise it should exist program in exception condition. I have to kill the application program through system processes. I am new to MFC. all the help is appreciated. Thanks.

        D 1 Reply Last reply
        0
        • G gurucplusplus

          Hang to me means the window application never come back and I can not access to any menu in main frame. The progam didn't throw an exception otherwise it should exist program in exception condition. I have to kill the application program through system processes. I am new to MFC. all the help is appreciated. Thanks.

          D Offline
          D Offline
          Demian Panello
          wrote on last edited by
          #4

          Ok. It happen running the programa in a debuging session?. Why do you think the AfxMessageBox function is the problem?.:doh: Try using the API MessageBox() instead, to see what happen. But I can't see a reason why AfxMessageBox will fail in that way. And one more. Do you link the program with MFC statically or shared?. (however this configuration it shouldn't "hang" your app., but to try something different).

          Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

          G 1 Reply Last reply
          0
          • D Demian Panello

            Ok. It happen running the programa in a debuging session?. Why do you think the AfxMessageBox function is the problem?.:doh: Try using the API MessageBox() instead, to see what happen. But I can't see a reason why AfxMessageBox will fail in that way. And one more. Do you link the program with MFC statically or shared?. (however this configuration it shouldn't "hang" your app., but to try something different).

            Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

            G Offline
            G Offline
            gurucplusplus
            wrote on last edited by
            #5

            It's strange. Even the standard MFC "About" dialog box hang the program as well. Not just AfxMessageBox. I could conclude that any pop-up messages dialog hang the program. I did try MessageBox(), it still hang the program. I have a test condition if it's failed pop up the message using AfxMessageBox(). If I comment it out the program will not hang. Help!!!!

            D 1 Reply Last reply
            0
            • G gurucplusplus

              It's strange. Even the standard MFC "About" dialog box hang the program as well. Not just AfxMessageBox. I could conclude that any pop-up messages dialog hang the program. I did try MessageBox(), it still hang the program. I have a test condition if it's failed pop up the message using AfxMessageBox(). If I comment it out the program will not hang. Help!!!!

              D Offline
              D Offline
              Demian Panello
              wrote on last edited by
              #6

              Yeah, very strange.:confused: For testing try the following: Build another SDI aplication and without any extra condition, add an AfxMessageBox() call somewhere, (ie: clicking in the view). If that works, try to think the last thing, (maybe some code), you did in your SDI application, before that strange behaviour. If the test don't work, so there's something wrong with your MFC libraries or you've change something in the default Visual Studio configuration, (but I don't think so). The subject of your post says: "AfxMessageBox stop working after split the frame". Well, if really this started to happen since split the FrameWindow, you should come back to that point and see which situations could turn every "modal dialog" to fail and hang the application. But look at this: (I think this is the real problem). It looks like your problem is that you "pop" a modal dialog and for some reason you can't see it and consequently you can close that "modal dialog", then it looks like the application is "hang", but it's not, just you can't close the modal dialog because you can't see it or is behind the frame.

              Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

              G 1 Reply Last reply
              0
              • D Demian Panello

                Yeah, very strange.:confused: For testing try the following: Build another SDI aplication and without any extra condition, add an AfxMessageBox() call somewhere, (ie: clicking in the view). If that works, try to think the last thing, (maybe some code), you did in your SDI application, before that strange behaviour. If the test don't work, so there's something wrong with your MFC libraries or you've change something in the default Visual Studio configuration, (but I don't think so). The subject of your post says: "AfxMessageBox stop working after split the frame". Well, if really this started to happen since split the FrameWindow, you should come back to that point and see which situations could turn every "modal dialog" to fail and hang the application. But look at this: (I think this is the real problem). It looks like your problem is that you "pop" a modal dialog and for some reason you can't see it and consequently you can close that "modal dialog", then it looks like the application is "hang", but it's not, just you can't close the modal dialog because you can't see it or is behind the frame.

                Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

                G Offline
                G Offline
                gurucplusplus
                wrote on last edited by
                #7

                Thanks for the suggestion. I debug the problem and found that I use InvalidateRect(NULL,FALSE) to redraw the graphic on the right pane in OnDraw(CDC *pDC) of CMyRightPaneView class causing all of my modal dialog to hang mh application. The question is how can I redraw both right and left panes of the splitter pane independently? Help!!!

                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