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. The thread 0x6B8 has exited with code 2 (0x2).

The thread 0x6B8 has exited with code 2 (0x2).

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++debugging
3 Posts 3 Posters 4 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.
  • V Offline
    V Offline
    valerie99
    wrote on last edited by
    #1

    Good afternoon I got this message for the app after finished debug: The thread 0x6B8 has exited with code 2 (0x2). The program 'C:\DEV\C++\Billing\Report\Debug\Report.exe' has exited with code 2 (0x2). the 0x6B8 thread is CDialog::OnCancel, the part of code that calling OnCancel is from here: LRESULT CReportDlg::OnComplete( WPARAM, LPARAM ) { m_thrReport.Wait( INFINITE ); PostMessage( WM_CLOSE ); return S_OK; } Is it because of infinite waiting causing exited with code 2? what is code 2 mean? thank you!

    B 1 Reply Last reply
    0
    • V valerie99

      Good afternoon I got this message for the app after finished debug: The thread 0x6B8 has exited with code 2 (0x2). The program 'C:\DEV\C++\Billing\Report\Debug\Report.exe' has exited with code 2 (0x2). the 0x6B8 thread is CDialog::OnCancel, the part of code that calling OnCancel is from here: LRESULT CReportDlg::OnComplete( WPARAM, LPARAM ) { m_thrReport.Wait( INFINITE ); PostMessage( WM_CLOSE ); return S_OK; } Is it because of infinite waiting causing exited with code 2? what is code 2 mean? thank you!

      B Offline
      B Offline
      Blake V Miller
      wrote on last edited by
      #2

      When the dialog-based MFC program exits, it usually returns the ID of the button that caused the closing, or else 2 meaning CANCEL or CLOSE and 0 meaning OK. If you want custom exit codes, override ExitInstance at application and set your own exit code.

      Q 1 Reply Last reply
      0
      • B Blake V Miller

        When the dialog-based MFC program exits, it usually returns the ID of the button that caused the closing, or else 2 meaning CANCEL or CLOSE and 0 meaning OK. If you want custom exit codes, override ExitInstance at application and set your own exit code.

        Q Offline
        Q Offline
        QueenAzula
        wrote on last edited by
        #3

        That's the answer I was looking for hours ago! Thank you kind Sir! After looking into the ressource.h-File I can confirm that it's because of the ID of the Control which lead to the end of the thread. For example: I was kinda terrified of the unknown thread-exit code 32780. Cannot look up what's this about because usually the exit codes are not as far specified. After launching my exit procedere mindlessly with my overloaded OnCancel with ID 32780 the weird exit messages kept coming. But I never thought that far. Hopefully someone will spare some time with this information. best regards

        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