最後讓我們分析一下C:VCTestVCComProjDebugValidateCreditCardServer.tlh作為Developing COM Components using VC-ATL(3)的結尾吧。
ValidateCreditCardServer.tlh清單
// Created by Microsoft (R) C/C++ Compiler Version 12.00.8168.0 (ad98f509).
//
// c:vctestvccomprojdebugValidateCreditCardServer.tlh
//
// C++ source equivalent of Win32 type library ..ValidateCreditCardServerDebugValidateCreditCardServer.dll
// compiler-generated file created 12/19/03 at 03:29:03 - DO NOT EDIT!
#pragma once
#pragma pack(push, 8)
#include <comdef.h>
namespace VALIDATECREDITCARDSERVERLib {…………………………………..………名字空間
//
// Forward references and typedefs
//
struct /* coclass */ ValidateCard;………………………………………………………………..….. 組件類
struct __declspec(uuid("b1d1c73c-e340-4fdc-8734-92ecec64dc4e"))
/* dual interface */ IValidateCard;………………………………………………….………………用戶接口
//
// Smart pointer typedef declarations
//
_COM_SMARTPTR_TYPEDEF(IValidateCard, __uuidof(IValidateCard));………..………智能指針
//
// Type library items
//
struct __declspec(uuid("c79635d2-7b86-4b20-a83c-0565dca54c3c"))…………………組件類CLSID
ValidateCard;
// [ default ] interface IValidateCard
struct __declspec(uuid("b1d1c73c-e340-4fdc-8734-92ecec64dc4e"))……………………用戶接口IID
IValidateCard : IDispatch
{
//
// Wrapper methods for error-handling
//
long ValidateCreditCard (
_bstr_t bstrCCNo,
_bstr_t bstrCCType );
HRESULT LuhnCheck (
_bstr_t bstrCCNo,
_bstr_t bstrCCType );
HRESULT LengthCheck (
_bstr_t bstrCCNo,
_bstr_t bstrCCType );
HRESULT PrefixCheck (
_bstr_t bstrCCNo,
_bstr_t bstrCCType );……………………………………………….………….. 接口方法(對外)
//
// Raw methods provided by interface
//
virtual HRESULT __stdcall raw_ValidateCreditCard (
BSTR bstrCCNo,
BSTR bstrCCType,
long * val ) = 0;
virtual HRESULT __stdcall raw_LuhnCheck (
BSTR bstrCCNo,
&nb
[1] [2] [3] 下一頁