Developing COM Components using VC-ATL(3-7) (轉)
最後讓我們分析一下C:VCTestVCComProjDeValidateCreditCardServer.tlh作為Develo Components using VC-ATL(3)的結尾吧。
ValidateCreditCardServer.tlh清單
// Created by Microsoft (R) C/C++ Compiler Version 12.00.8168.0 (ad98f509).
//
// c:vctestvccomprojdebugValidateCreditCardServer.tlh
//
// C++ equivalent of type library ..ValidateCreditCardServerDebugValidateCreditCardServer.dll
// compiler-generated file created
#pragma once
#pragma pack(push, 8)
#include
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 provd 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:vctestvccomprojdebugValidateCreditCardServer.tli"………….. 型別庫實現
} // namespace VALIDATECREDITCARDSERVERLib……………………………..……….. 名字空間
#pragma pack(pop)
參照COM元件端C:ValidateCreditCardServerValidateCreditCardServer.idl
ValidateCreditCardServer.idl清單
// ValidateCreditCardServer.idl : IDL source for ValidateCreditCardServer.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (ValidateCreditCardServer.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
,
uuid(B1D1C73C-E340-4FDC-8734-92ECEC64DC4E),……………………………. IID部分
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-5783CEEFEC),………………………………… LIBID部分
version(1.0),
helpstring("ValidateCreditCardServer 1.0 Type Library")
]
library VALIDATECREDITCARDSERVERLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(C79635D2-7B86-4B20-A83C-0565DCA54C3C),…………………….……CLSID部分
helpstring("ValidateCard Class")
]
coclass ValidateCard
{
[default] interface IValidateCard;
};
};
小結:
Developing COM Components using VC-ATL(3)主要介紹了Visual C++與編寫的元件的相互間的。在接下來一篇裡將介紹雙介面。
Developing COM Components using VC-ATL(3)完
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752019/viewspace-963673/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Developing COM Components using VC-ATL(1) (轉)dev
- Developing COM Components using VC-ATL(2-3) (轉)dev
- Developing COM Components using VC-ATL(2-2) (轉)dev
- Developing COM Components using VC-ATL(3-3) (轉)dev
- Developing COM Components using VC-ATL(3-5) (轉)dev
- Developing COM Components using VC-ATL(3-4) (轉)dev
- Developing COM Components using VC-ATL(3-6) (轉)dev
- Developing for ARKit 1.5 update using Unity ARKit PlugindevUnityPlugin
- [轉帖]10 Hardware Components of Oracle ExadataOracle
- Angular 2 Components CommunicateAngular
- 探索Web ComponentsWeb
- [譯] Architecture Components 之 Adding Components to your ProjectProject
- 從HTML Components的衰落看Web Components的危機HTMLWeb
- Web Components 小欖Web
- 「 重磅 」React Server ComponentsReactServer
- Styled-Components初探
- Web Components 原生元件 TrendsWeb元件
- 【譯】Web Components簡介Web
- Web Components系列(一) —— 概述Web
- Building Custom ComponentsUI
- astro中建立web componentsASTWeb
- SAP Commerce Cloud Build Manifest ComponentsCloudUI
- Flutter Flame 教程3 -- Components元件Flutter元件
- 初識 Web Components 與 StencilWeb
- 【譯】容器元件 (Container Components)元件AI
- Atag – Web Components 最佳實踐Web
- visual components premium特色功能REM
- Web Components之Custom ElementsWeb
- Altium designer 從原理圖更新至PCB時出現提示:failed to match * of * components using unique identifiersAIIDE
- XML 程式設計思想: UBL 1.0(以及 ebXML Core Components 等)(轉)XML程式設計
- Web Components 入門例項教程Web
- [譯] styled-components v3.1.0
- [譯] Web Components 的高階工具Web
- Visual Components軟體特點
- 淺析Web components的痛點Web
- Web Components 系列(五)—— 關於 TemplatesWeb
- Web Components 系列(五)—— 詳解 SlotsWeb
- CSS in JS 之 Styled-components 用法CSSJS