Click here to Skip to main content
15,884,537 members
Articles / Programming Languages / C++

COM from scratch - PART TWO

Rate me:
Please Sign up or sign in to vote.
4.85/5 (44 votes)
17 Apr 200414 min read 226.1K   6K   134  
An article about COM Library.
//
// Definition of IIDs and GUIDs for interfaces and components
//
//IDs:
extern "C" const IID IID_IComponent1 ;
extern "C" const IID IID_IComponent2 ;
extern "C" const IID IID_IComponent3 ;


//CLSIDs:
extern "C" const CLSID CLSID_Component1 ;
extern "C" const CLSID CLSID_Component2 ;
extern "C" const CLSID CLSID_Component3 ;



//IID and GUID for Component 1
// The extern is required to allocate memory for C++ constants.
// {24A0BDB0-596E-4faa-98A6-D715A675679E}
extern "C" const IID IID_IComponent1 = 
{ 0x24a0bdb0, 0x596e, 0x4faa, { 0x98, 0xa6, 0xd7, 0x15, 0xa6, 0x75, 0x67, 0x9e } };

// {3B410A55-1E19-439c-B624-09D2EA3143D3}
extern "C" const GUID CLSID_Component1 = 
{ 0x3b410a55, 0x1e19, 0x439c, { 0xb6, 0x24, 0x9, 0xd2, 0xea, 0x31, 0x43, 0xd3 } };




//IID and GUID for Component 2
// {6FE2F675-F248-46ea-81C4-67DD90014A2E}
extern "C" const IID IID_IComponent2= 
{ 0x6fe2f675, 0xf248, 0x46ea, { 0x81, 0xc4, 0x67, 0xdd, 0x90, 0x1, 0x4a, 0x2e } };

// {82CC39BB-9A84-4000-9D38-8879CB42B518}
extern "C" const GUID CLSID_Component2= 
{ 0x82cc39bb, 0x9a84, 0x4000, { 0x9d, 0x38, 0x88, 0x79, 0xcb, 0x42, 0xb5, 0x18 } };




//IID and GUID for Component 3
// {DF2EE01C-277B-4332-B944-3A815783A0CD}
// {8C984E0C-A23A-4ee3-A8BE-902684DE938C}
extern "C" const IID IID_IComponent3 = 
{ 0x8c984e0c, 0xa23a, 0x4ee3, { 0xa8, 0xbe, 0x90, 0x26, 0x84, 0xde, 0x93, 0x8c } };



// {F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}
extern "C" const GUID CLSID_Component3 = 
{ 0xf0bba28d, 0x6471, 0x4b4e, { 0xb7, 0xec, 0xb3, 0xb1, 0xf0, 0x82, 0xb4, 0x7a } };





// Interface definitions:
//Component1
interface IComponent1 : IUnknown
{
 
	virtual void __stdcall DefineWindow_Com1(bool inner)=0;
    virtual void __stdcall ShowWndBackground_Com1(COLORREF bgcolor)=0;
    virtual IUnknown* __stdcall Queryitself1()=0;
    virtual void __stdcall MenuitemNotselected1()=0;
    virtual void __stdcall Night()=0;
} ;

//Component2
interface IComponent2 : IUnknown
{
 
	virtual void __stdcall DefineWindow_Com2(bool inner)=0;
    virtual void __stdcall ShowWndBackground_Com2(COLORREF bgcolor)=0;
    virtual IUnknown* __stdcall Queryitself2()=0;
    virtual void __stdcall MenuitemNotselected2()=0;
    virtual void __stdcall StopFlying()=0;
    virtual void __stdcall StartFlying()=0;
} ;
//Component3
interface IComponent3 :IComponent1,IComponent2 
{
 
	virtual void __stdcall DefineWindow_Com3()=0;
    virtual void __stdcall ShowWndBackground_Com3(COLORREF bgcolor)=0;
    virtual IUnknown* __stdcall Queryitself3()=0;
    virtual void __stdcall MenuitemNotselected3()=0;
   
} ;


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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer
Denmark Denmark
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions