Developing COM Components Using VC-ATL (3-7)

xiaoxiao2021-03-06  31

Finally, let us analyze C: /VCTestVcCCCCCCAJ/debug/validatecreditcardServer.TLH as the end of Developing CoM Components Using VC-ATL (3).

ValidatecreditCardServer.tlh list

// Created by Microsoft (R) C / C Compiler Version 12.00.8168.0 (AD98F509).

//

// c: /vctestvcc.comproj/debug/validatecreditcardServer.tlh

//

// C Source Equivalent of Win32 Type Library ../validatecreditcardServer/debug/validatecreditcardServer.dll

// compiler-generated file created

12/19/03

AT

03:29:03

- Do Not Edit!

#pragma overce

#pragma Pack (Push, 8)

#include

Namespace ValidatecreditcardServerLib {...................................... ......... namespace

//

// forward references and typedefs

//

Struct / * coclass * / validatecard; ........................................................................................ .. ... .. Component Class

Struct __Declspec (UUID ("B1D1C73C-E340-4FDC-8734-92ECEC64DC4E"))

/ * dual interface * / ivalidatecard; .................................................................................................

//

// Smart Pointer Typedef Declarations

//

_COM_SMARTPTR_TYPEDEF (ivalidatecard, __UUIDOF (ivalidatecard); .......... ......... smart pointer

//

// Type Library Items

//

Struct __declspec (UUID ("C79635D2-7B86-4B20-A83C-0565DCA54C3C")) ...............................................................................................

Validatecard;

// [Default] Interface IvalIdateCard

Struct __declspec (UUID ("B1D1C73C-E340-4FDC-8734-92ecec64DC4E")) ..................... User interface 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,

BSTR BSTRCCTYPE) = 0;

Virtual HRESULT __STDCALL RAW_LENGTHCHECK

BSTR BSTRCCNO,

BSTR BSTRCCTYPE) = 0;

Virtual HRESULT __STDCALL RAW_PREFIXCHECK

BSTR BSTRCCNO,

BSTR BSTRCCTYPE) = 0; .......................................................................................................

}

//

// Wrapper Method IMPLEMENTATIONS

//

#include "c: /vctestvccomproj/debug/validatecreditcardserver.tli" ............ .. Type library implementation file

} // Namespace ValidatecreditcardServerLib ................................ ....................

#pragma pack (POP)

Refer to COM component C: /ValidatecreditcardServer/ValidatecreditcardServer.IDL

ValidatecreditCardServer.IDL list

// validatecreditcardser.idl: idl source for validatecreditcardServer.dll

//

// this file will be processed by the Mid Tool To

// produted the Type Library (ValidatecreditcardServer.tlb) and Marshalling Code.

Import "OAIDL.IDL";

Import "OCIDL.IDL";

[

Object,

UUID (B1D1C73C-E340-4FDC-8734-92ecec64DC4E), ...........................................

Dual,

Helpstring ("iValidateCard Interface",

Pointer_DEFAULT (UNIQUE)

]

Interface ivalidatecard: idispatch

{

[ID (1), Helpstring ("Method Validatecreditcard")] HRESULT VALIDATECREDITCARD ([in] BSTR BSTRCCNO, [IN] BSTR BSTRCCTYPE, [OUT, RETVAL] long * VAL);

[ID (2), Helpstring ("Method Luhncheck")] HRESULT Luhncheck ([in] BSTR BSTRCCNO, [IN] BSTR BSTRCCTYPE);

[ID (3), Helpstring ("Method Lengthcheck")] HRESULT Lengthcheck ([in] BSTR BSTRCCNO, [IN] BSTR BSTRCCTYPE);

[ID (4), Helpstring ("Method PrefixCheck")] HRESULT Prefixcheck ([in] BSTR BSTRCCNO, [IN] BSTR BSTRCCTYPE);

}

[

UUID (B3404054-C33E-4931-B737-5783CEEFECDB), ................................. il part

Version (1.0),

Helpstring ("ValidatecreditcardServer 1.0 Type Library)]]

Library ValidatecreditcardServerLib

{

Importlib ("stdole32.tlb");

Importlib ("stdole2.tlb");

[

UUID (C79635D2-7B86-4B20-A83C-0565DCA54C3C), .......................... CLSID section

Helpstring ("ValidateCard Class")

]

CoClass ValidateCard

{

[Default] interface ivalidatecard;

}

}

summary:

Developing CoM Components Using VC-ATL (3) mainly describes the intermienary calls of the components written in Visual C and Visual Basic. The two interfaces will be introduced in one of the next one.

Developing COM Components Using VC-ATL (3)

Author Blog:

http://blog.9cbs.net/callzjy/

转载请注明原文地址:https://www.9cbs.com/read-77817.html

New Post(0)