Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Understanding The COM Single-Threaded Apartment Part 1

, 6 Jan 2005 CPOL
Learn the fundamental principles of the COM Single-Threaded Apartment Model by code examples.
ccomthread_src.zip
LegacyCOMObject1
Shared
SimpleCOMObject1
SimpleCOMObject2
Test Programs
LegacyCOMObject1.def
LegacyCOMObject1.dsp
LegacyCOMObject1.dsw
LegacyCOMObject1.rgs
LegacyCOMObject1.tlb
LegacyCOMObject1ps.def
LegacyCOMObject1ps.mk
SimpleCOMObject1.def
SimpleCOMObject1.dsp
SimpleCOMObject1.dsw
SimpleCOMObject1.rgs
SimpleCOMObject1.tlb
SimpleCOMObject1ps.def
SimpleCOMObject1ps.mk
SimpleCOMObject2.def
SimpleCOMObject2.dsp
SimpleCOMObject2.dsw
SimpleCOMObject2.rgs
SimpleCOMObject2.tlb
SimpleCOMObject2ps.def
SimpleCOMObject2ps.mk
VBTest
VCTests
FormMain.frm
MSSCCPRJ.SCC
VBTest.exe
VBTest.vbp
VBTest.vbw
DemonstrateDefaultSTA
DemonstrateExeServerSTA
DemonstrateLegacySTA
DemonstrateNoMessageLoop
DemonstrateSTA
VCTest01
VCTest02
SimpleCOMObject2.tlh
SimpleCOMObject2.tli
VCTest01.dsp
VCTest01.dsw
SimpleCOMObject2.tlh
SimpleCOMObject2.tli
VCTest02.dsp
VCTest02.dsw
Client
Implementation
Interface
VCTest01
VCTest01.dsp
VCTest01.dsw
ExeServerImpl
ExeServerImpl.dsp
ExeServerImpl.dsw
ExeServerInterfaces
ExeObj01.rgs
ExeObj02.rgs
ExeObj03.rgs
ExeServerInterfaces.def
ExeServerInterfaces.dsp
ExeServerInterfaces.dsw
ExeServerInterfaces.tlb
ExeServerInterfacesps.def
ExeServerInterfacesps.mk
VCTest01
VCTest02
LegacyCOMObject1.tlh
LegacyCOMObject1.tli
VCTest01.dsp
VCTest01.dsw
VCTest02.dsp
VCTest02.dsw
VCTest01
SimpleCOMObject2.tlh
SimpleCOMObject2.tli
VCTest01.dsp
VCTest01.dsw
VCTest01
SimpleCOMObject2.tlh
SimpleCOMObject2.tli
VCTest01.dsp
VCTest01.dsw
// ExeObj01.h : Declaration of the CExeObj01

#ifndef __EXEOBJ01_H_
#define __EXEOBJ01_H_

#include "resource.h"       // main symbols

/////////////////////////////////////////////////////////////////////////////
// CExeObj01
class ATL_NO_VTABLE CExeObj01 : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CExeObj01, &CLSID_ExeObj01>,
	public ISupportErrorInfo,
	public IConnectionPointContainerImpl<CExeObj01>,
	public IDispatchImpl<IExeObj01, &IID_IExeObj01, &LIBID_EXESERVERINTERFACESLib>
{
public:
	CExeObj01()
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_EXEOBJ01)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CExeObj01)
	COM_INTERFACE_ENTRY(IExeObj01)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
	COM_INTERFACE_ENTRY(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CExeObj01)
END_CONNECTION_POINT_MAP()


// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

// IExeObj01
public:
	STDMETHOD(TestMethod1)();
};

#endif //__EXEOBJ01_H_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Lim Bio Liong
Web Developer
Singapore Singapore
Lim Bio Liong is a Specialist at a leading Software House in Singapore.
 
Bio has been in software development for over 10 years. He specialises in C/C++ programming and Windows software development.
 
Bio has also done device-driver development and enjoys low-level programming. Bio has recently picked up C# programming and has been researching in this area.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.1411023.1 | Last Updated 6 Jan 2005
Article Copyright 2005 by Lim Bio Liong
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid