Thread Exit Codes

Explantion of thread exit codes.

  • (2 Pages)
  • +
  • 1
  • 2

20 Replies - 5518 Views - Last Post: 23 September 2009 - 12:40 PM Rate Topic: -----

#1 BidSki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 30-June 05

Thread Exit Codes

Posted 21 September 2009 - 02:34 AM

Hello all,

I keep receiving the following error messages (these are displayed in debug window) whenever i debug my program.

The thread 0x108C has exited with code 3 (0x3).
The thread 0x1594 has exited with code 3 (0x3).
The program 'E:\PC\VC++\MRP\Debug\MRP.exe' has exited with code 3 (0x3).



What is exit code 3? The only explanation for this error code i have found doesn't make much sense. (The system cannot find the path specified.)

The line that the error is generated on is

CInventory::CInventory(CWnd* pParent /*=NULL*/)
	: CDialog(CInventory::IDD, pParent)
{							   // ERROR OCCURS ON THIS LINE!!!!!
	//{{AFX_DATA_INIT(CInventory)
	//}}AFX_DATA_INIT
}



This part of the code is called from a button click event as follows

void CMRPDlg::OnInventory() 
{
	CInventory inv;  // if i use "step-over" rather than "step-into" during debug, the error is generated on this line.

	inv.DoModal();
}



I do attempt to open a file, but I have a error handler in place and that does not get triggered so I dont feel as though that is the cause of my problem. I have posted the code for it regardless, just to save everyone asking for it :P

	sprintf(pFileName, "%s\\Categories.mrp", App.AppPath);

	if(!fCat.Open(pFileName, CFile::modeCreate|CFile::modeReadWrite|CFile::modeNoTruncate, &e))
	{
		AfxMessageBox("Category file could not be opened");
		TRACE("File could not be opened %s\n", e.m_cause);

		bError = true;
	}



Whenever i run the program a dialog box pops up (a windows error one) stating that a debug assertion failed. (I have attached a screenshot of the dialog box).

Attached Image

Can anyone tell me whats happening here? Or atleast point me in the right direction?

Thanks in advance.
Bidski

Is This A Good Question/Topic? 0
  • +

Replies To: Thread Exit Codes

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6036
  • View blog
  • Posts: 23,421
  • Joined: 23-August 08

Re: Thread Exit Codes

Posted 21 September 2009 - 06:20 AM

Possibly?

CInventory::CInventory(CWnd* pParent /*=NULL*/)
    : CDialog(CInventory::IDD, pParent)



Does CInventory::IDD have a valid value? Is it an integer, or a string?
Was This Post Helpful? 0
  • +
  • -

#3 BidSki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 30-June 05

Re: Thread Exit Codes

Posted 21 September 2009 - 12:45 PM

Its ClassWizard generated code, so I didnt actually write that part myself, but just having a quick look now I found this in the CInventory header file.

	enum { IDD = IDD_INVENTORY };



and this in the Resource.h file (header file for all resources)

#define IDD_INVENTORY				   1000



So, my educated guess would be that CInventory:IDD would be an int

Bidski
Was This Post Helpful? 0
  • +
  • -

#4 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,405
  • Joined: 15-July 09

Re: Thread Exit Codes

Posted 21 September 2009 - 01:28 PM

Is this program your?
How come you are guessing?

By the way IDD and IDD_INVENTORY are not the same thing.

Can you post more code?
Was This Post Helpful? 0
  • +
  • -

#5 BidSki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 30-June 05

Re: Thread Exit Codes

Posted 21 September 2009 - 07:48 PM

Yes, this is my code. I was guessing because it was about 5am when i wrote that post.

By simple deduction, my interpretation of the code is that

CInventory::IDD = enum { IDD = IDD_INVENTORY } = IDD_INVENTORY

Being that enum { IDD = IDD_INVENTORY } is defined inside the CInventory class.

Sure i can post more code. Is there any part in particular that you would like to see?

Bidski
Was This Post Helpful? 0
  • +
  • -

#6 carltech  Icon User is offline

  • What did you call me?
  • member icon

Reputation: 28
  • View blog
  • Posts: 997
  • Joined: 19-October 07

Re: Thread Exit Codes

Posted 21 September 2009 - 09:27 PM

does the compiler know where to find the header file? is in in the same folder or in somewhere where it knows how to find it?

Wasn't thinking

This post has been edited by carltech: 22 September 2009 - 12:58 AM

Was This Post Helpful? 0
  • +
  • -

#7 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,405
  • Joined: 15-July 09

Re: Thread Exit Codes

Posted 21 September 2009 - 10:02 PM

View PostBidSki, on 21 Sep, 2009 - 06:48 PM, said:

Yes, this is my code. I was guessing because it was about 5am when i wrote that post.

By simple deduction, my interpretation of the code is that

CInventory::IDD = enum { IDD = IDD_INVENTORY } = IDD_INVENTORY

Being that enum { IDD = IDD_INVENTORY } is defined inside the CInventory class.

Sure i can post more code. Is there any part in particular that you would like to see?

Bidski


Yea sorry i didnt saw your 2nd post for some reason :P

Is it posible to see the header?

Im guessing not, well atleast the declarations of the fuctions that we are looking at
Was This Post Helpful? 0
  • +
  • -

#8 BidSki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 30-June 05

Re: Thread Exit Codes

Posted 22 September 2009 - 12:57 AM

Quote

does the compiler know where to find the header file? is in in the same folder or in somewhere where it knows how to find it?


I assume that since the program is compiling that the compiler is finding all the header files

Quote

Is it posible to see the header?

Im guessing not, well atleast the declarations of the fuctions that we are looking at


This is the class declaration for CInventory

class CInventory : public CDialog
{
// Construction
public:
	CInventory(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(CInventory)
	enum { IDD = IDD_INVENTORY };
	CStatic	m_txtSupplierCurrency;
	CStatic	m_picPartImage;
	CEdit	m_txtWeight;
	CEdit	m_txtRevision;
	CEdit	m_txtPack;
	CEdit	m_txtAllocated;
	CEdit	m_txtCost;
	CEdit	m_txtSupplierPN;
	CEdit	m_txtSupplier;
	CEdit	m_txtSellPrice;
	CButton	m_chkRoHS;
	CEdit	m_txtPartNumber;
	CEdit	m_txtPar4;
	CEdit	m_txtPar3;
	CEdit	m_txtPar2;
	CEdit	m_txtPar1;
	CEdit	m_txtOrdered;
	CEdit	m_txtOnhand;
	CEdit	m_txtMOQ;
	CEdit	m_txtManufacturerPN;
	CEdit	m_txtManufacturer;
	CButton	m_chkManageStock;
	CEdit	m_txtLocation;
	CEdit	m_txtForeignCost;
	CEdit	m_txtDescription;
	CEdit	m_txtComment;
	CListBox	m_lstPartsList;
	CTreeCtrl	m_tvwCategories;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CInventory)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CInventory)
	virtual BOOL OnInitDialog();
	afx_msg void OnSelchangedCategories(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnDestroy();
	afx_msg void OnItemexpandedCategories(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSelchangeParts();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	CMRPDB MRPDB;
	CMRPCategories MRPCategories;

	void ShowPic(char *path);
};



Does that help?

Bidski
Was This Post Helpful? 0
  • +
  • -

#9 carltech  Icon User is offline

  • What did you call me?
  • member icon

Reputation: 28
  • View blog
  • Posts: 997
  • Joined: 19-October 07

Re: Thread Exit Codes

Posted 22 September 2009 - 01:07 AM

Is it legit to have an enum without a name?
Was This Post Helpful? 0
  • +
  • -

#10 BidSki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 30-June 05

Re: Thread Exit Codes

Posted 22 September 2009 - 01:19 AM

Ask microsoft, that part is their code.
Was This Post Helpful? 0
  • +
  • -

#11 carltech  Icon User is offline

  • What did you call me?
  • member icon

Reputation: 28
  • View blog
  • Posts: 997
  • Joined: 19-October 07

Re: Thread Exit Codes

Posted 22 September 2009 - 01:43 AM

It appears to have something to do with your trace. Here is the msdn on that part of the debugging.

And here is osme info on the Trace Class.

This post has been edited by carltech: 22 September 2009 - 01:43 AM

Was This Post Helpful? 0
  • +
  • -

#12 BidSki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 30-June 05

Re: Thread Exit Codes

Posted 22 September 2009 - 03:39 AM

That appears to be referring to VC++ .NET. Im using VC++ 6

You refer to my TRACE, but as I stated earlier I dont even think the code is getting that far and I have many other TRACE calls through-out my code that arent much different from that one which are causing me no problems.
Bidski

This post has been edited by BidSki: 22 September 2009 - 03:45 AM

Was This Post Helpful? 0
  • +
  • -

#13 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6036
  • View blog
  • Posts: 23,421
  • Joined: 23-August 08

Re: Thread Exit Codes

Posted 22 September 2009 - 08:59 AM

I've done very little MFC in the past 10 years, so I'm out of my element. Did you check the link in my previous post, by any chance?

You might have better luck asking on an MFC-specialized forum, such as at MSDN.
Was This Post Helpful? 0
  • +
  • -

#14 carltech  Icon User is offline

  • What did you call me?
  • member icon

Reputation: 28
  • View blog
  • Posts: 997
  • Joined: 19-October 07

Re: Thread Exit Codes

Posted 22 September 2009 - 10:37 AM

I don't think your link applies to VC++ 6 either.

What happens if you hit ignore???
Does you program end, continue or crash?

I may be wrong but isn't this the cause of debugging being used in your code in the form of an Assert or Trace?
Was This Post Helpful? 0
  • +
  • -

#15 BidSki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 30-June 05

Re: Thread Exit Codes

Posted 22 September 2009 - 12:39 PM

Yes, I had a look at that link and I have such a variable defined (this is also done automatically at project generation by ClassWizard)
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2