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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. AfxMessage doesn’t block

AfxMessage doesn’t block

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelpdesignannouncement
5 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi I’m again having different results in debug and release this one isn’t a bug but different program behavior. I have 4 CwinThread Wrappers for CAsynSocket In debug because processing is slowed somewhat by int 3 breakpoints I Receive all my about 3500 bytes of data from the Mainframe computer. In release I don’t get it all in one transmission I have a full word or a short int in the begging of the stream to tell me how much data My method to debug this in the past was issue a AfxMessage and attach the debugger This always seemed to work with the Mainthread I didn’t even notice the message box come up in this scenario except by hovering my mouse on the tray at the bottom of the screen I don’t think I can use __debugbreak in Release Anyway to stop this thread so that I can attach the debugger to see what’s going on I forgot to add this UI thread was created before I created the CMainFrame Window however in the past I was able to have an AfxMessageBox in the CWinApp constructor and it worked Thanks

    V 1 Reply Last reply
    0
    • F ForNow

      Hi I’m again having different results in debug and release this one isn’t a bug but different program behavior. I have 4 CwinThread Wrappers for CAsynSocket In debug because processing is slowed somewhat by int 3 breakpoints I Receive all my about 3500 bytes of data from the Mainframe computer. In release I don’t get it all in one transmission I have a full word or a short int in the begging of the stream to tell me how much data My method to debug this in the past was issue a AfxMessage and attach the debugger This always seemed to work with the Mainthread I didn’t even notice the message box come up in this scenario except by hovering my mouse on the tray at the bottom of the screen I don’t think I can use __debugbreak in Release Anyway to stop this thread so that I can attach the debugger to see what’s going on I forgot to add this UI thread was created before I created the CMainFrame Window however in the past I was able to have an AfxMessageBox in the CWinApp constructor and it worked Thanks

      V Offline
      V Offline
      Victor Nijegorodov
      wrote on last edited by
      #2

      Why are you using AfxMessageBox in a secondary thread? :confused:

      F 1 Reply Last reply
      0
      • V Victor Nijegorodov

        Why are you using AfxMessageBox in a secondary thread? :confused:

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        Will use Message box establish my main window before thread creation and will move the CFrameWnd ::m_hWnd to UI thread window thanks

        V 1 Reply Last reply
        0
        • F ForNow

          Will use Message box establish my main window before thread creation and will move the CFrameWnd ::m_hWnd to UI thread window thanks

          V Offline
          V Offline
          Victor Nijegorodov
          wrote on last edited by
          #4

          It is not a good design to display a messagebox form any secondary thread. Better would be PostMessage a user defined message to the main GUI thread with the parameters that you want to be displayed and let the main thread display it.

          F 1 Reply Last reply
          0
          • V Victor Nijegorodov

            It is not a good design to display a messagebox form any secondary thread. Better would be PostMessage a user defined message to the main GUI thread with the parameters that you want to be displayed and let the main thread display it.

            F Offline
            F Offline
            ForNow
            wrote on last edited by
            #5

            This is just to debug a scenario that only happen in release I have to have a way of stopping the thread in release and attaching the debugger if there is a better way please share thanks

            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