// Apartment.h : Declaration of the CApartment

#ifndef __APARTMENT_H_
#define __APARTMENT_H_

#include "resource.h"       // main symbols

/////////////////////////////////////////////////////////////////////////////
// CApartment
class ATL_NO_VTABLE CApartment : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CApartment, &CLSID_MsjJavademoApartment>,
	public IDispatchImpl<IGetCurrentThreadID, &IID_IGetCurrentThreadID, &LIBID_THREADSVLib>
{
public:
	CApartment()
	{
		char out [256] ; 
		wsprintf (out, "Control created on thread %d", GetCurrentThreadId()) ;
		MessageBox (NULL, out, "Apartment", 0) ;
	}

DECLARE_REGISTRY_RESOURCEID(IDR_APARTMENT)

BEGIN_COM_MAP(CApartment)
	COM_INTERFACE_ENTRY(IGetCurrentThreadID)
	COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()

// IApartment
public:
	STDMETHOD(get_CurrentThreadId)(/*[out, retval]*/ long *pVal);
};

#endif //__APARTMENT_H_
