Click here to Skip to main content
14,209,015 members
Click here to Skip to main content
Posted 31 Dec 2004

Stats

712.3K views
4.5K downloads
436 bookmarked

Understanding The COM Single-Threaded Apartment Part 1

,
Rate this:
4.95 (201 votes)
Please Sign up or sign in to vote.
4.95 (201 votes)
6 Jan 2005     CPOL    
Learn the fundamental principles of the COM Single-Threaded Apartment Model by code examples.
LegacyCOMObject1
Shared
SimpleCOMObject1
SimpleCOMObject2
Test Programs
LegacyCOMObject1.def
LegacyCOMObject1.dsp
LegacyCOMObject1.dsw
LegacyCOMObject1.rgs
LegacyCOMObject1.tlb
LegacyCOMObject1ps.def
SimpleCOMObject1.def
SimpleCOMObject1.dsp
SimpleCOMObject1.dsw
SimpleCOMObject1.rgs
SimpleCOMObject1.tlb
SimpleCOMObject1ps.def
SimpleCOMObject2.def
SimpleCOMObject2.dsp
SimpleCOMObject2.dsw
SimpleCOMObject2.rgs
SimpleCOMObject2.tlb
SimpleCOMObject2ps.def
VBTest
VCTests
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
REGISTRY.CPP
REGISTRY.H
ExeServerInterfaces
ExeObj01.rgs
ExeObj02.rgs
ExeObj03.rgs
ExeServerInterfaces.def
ExeServerInterfaces.dsp
ExeServerInterfaces.dsw
ExeServerInterfaces.tlb
ExeServerInterfacesps.def
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
// LegacyCOMObject1.idl : IDL source for LegacyCOMObject1.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (LegacyCOMObject1.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";
	[
		object,
		uuid(2E85D9EA-84E5-4767-8010-6400BA59CDBF),
		dual,
		helpstring("ILegacyCOMObject1 Interface"),
		pointer_default(unique)
	]
	interface ILegacyCOMObject1 : IDispatch
	{
		[id(1), helpstring("method TestMethod1")] HRESULT TestMethod1();
	};

[
	uuid(6934F572-21B7-43DE-BDCD-B909DA3C572B),
	version(1.0),
	helpstring("LegacyCOMObject1 1.0 Type Library")
]
library LEGACYCOMOBJECT1Lib
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");

	[
		uuid(F82638B5-058B-46EE-95D7-988AF15A694E),
		helpstring("_ILegacyCOMObject1Events Interface")
	]
	dispinterface _ILegacyCOMObject1Events
	{
		properties:
		methods:
	};

	[
		uuid(81A0A4E9-F514-4932-95AA-632F767429E6),
		helpstring("LegacyCOMObject1 Class")
	]
	coclass LegacyCOMObject1
	{
		[default] interface ILegacyCOMObject1;
		[default, source] dispinterface _ILegacyCOMObject1Events;
	};
};

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
Systems Engineer NEC
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.

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