Developing COM Components using VC-ATL(2-7)

类别:VC语言 点击:0 评论:0 推荐:

十、MyProj_i.c

    代码选取

/* this file contains the actual definitions of */

/* the IIDs and CLSIDs */

/* link this file in with the server and any clients */

/* File created by MIDL compiler version 5.01.0164 */

/* at Sun Nov 30 23:39:23 2003

 */

/* Compiler settings for C:\MyProj\MyProj.idl:

    Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext

    error checks: allocation ref bounds_check enum stub_data

*/

//@@MIDL_FILE_HEADING(  )

#ifdef __cplusplus

extern "C"{

#endif

#ifndef __IID_DEFINED__

#define __IID_DEFINED__

typedef struct _IID

{

    unsigned long x;

    unsigned short s1;

    unsigned short s2;

    unsigned char  c[8];

} IID;

#endif // __IID_DEFINED__

#ifndef CLSID_DEFINED

#define CLSID_DEFINED

typedef IID CLSID;

#endif // CLSID_DEFINED

const IID IID_IMyCom = {0x65460F9C,0x3BAB,0x4055,{0x88,0x5A,0x8E,0xD5,0x9F,0x5F,0xA9,0xB0}};

const IID LIBID_MYPROJLib = {0xFE651184,0x11DE,0x4D01,{0xBD,0x69,0xB0,0x7D,0xDF,0xA1,0x2D,0x0C}};

const CLSID CLSID_MyCom = {0xFEB7BDEF,0xFB6F,0x446B,{0xBE,0x31,0xDF,0x0A,0x3A,0xD3,0x91,0xBA}};

#ifdef __cplusplus

}

#endif

 

十一、MyCom.rgs

    代码选取

HKCR

{

         MyProj.MyCom.1 = s 'MyCom Class'

         {

                   CLSID = s '{FEB7BDEF-FB6F-446B-BE31-DF0A3AD391BA}'

         }

         MyProj.MyCom = s 'MyCom Class'

         {

                   CLSID = s '{FEB7BDEF-FB6F-446B-BE31-DF0A3AD391BA}'

                   CurVer = s 'MyProj.MyCom.1'

         }

         NoRemove CLSID

         {

                   ForceRemove {FEB7BDEF-FB6F-446B-BE31-DF0A3AD391BA} = s 'MyCom Class'

                   {

                            ProgID = s 'MyProj.MyCom.1'

                            VersionIndependentProgID = s 'MyProj.MyCom'

                            ForceRemove 'Programmable'

                            InprocServer32 = s '%MODULE%'

                            {

                                     val ThreadingModel = s 'Apartment'

                            }

                            'TypeLib' = s '{FE651184-11DE-4D01-BD69-B07DDFA12D0C}'

                   }

         }

}

代码剖析

组件注册时用,在这里你可以更改组件的在注册时存放在注册表中的名称及组件的其他相关注册信息。

 

Developing COM Components using VC-ATL(2)完 

本文地址:http://com.8s8s.com/it/it1296.htm