// CommonTest.cpp : This file contains the 'main' function. Program execution begins and ends there.

//

#include <iostream>

#include <atlbase.h>

#include "mbnapi.h"

int main()

{

HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);

if (FAILED(hr))

{

return -1;

}

CComPtr<IMbnInterfaceManager>  mbnInterfaceMgr = NULL;

hr = CoCreateInstance(CLSID_MbnInterfaceManager,NULL,CLSCTX_ALL,IID_IMbnInterfaceManager,(void**)&mbnInterfaceMgr);

if (FAILED(hr))

{

return -1;

}

SAFEARRAY* psa = NULL;

hr = mbnInterfaceMgr->GetInterfaces(&psa);

if (FAILED(hr))

{

CoUninitialize();

return -1;

}

LONG lLower;

hr = SafeArrayGetLBound(psa, 1, &lLower);

if (FAILED(hr))

{

CoUninitialize();

return -1;

}

LONG lUpper;

hr = SafeArrayGetUBound(psa, 1, &lUpper);

if (FAILED(hr))

{

CoUninitialize();

return -1;

}

CComPtr<IMbnInterface>  pInf = NULL;

for (LONG l = lLower; l <= lUpper; l++)

{

hr = SafeArrayGetElement(psa, &l, (void*)(&pInf));

if (SUCCEEDED(hr))

{

CComPtr<IMbnSubscriberInformation> subscriberInf = NULL;

hr = pInf->GetSubscriberInformation(&subscriberInf);

if (SUCCEEDED(hr)) {

WCHAR tszID[256] = { L'\0' };

hr = subscriberInf->get_SubscriberID((BSTR*)&tszID);

if (SUCCEEDED(hr)) {

std::wcout << L"SubscriberID: " << tszID <<std::endl;

}

}

}

}

SafeArrayDestroy(psa);

CoUninitialize();

return 0;

}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu

// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started:

//   1. Use the Solution Explorer window to add/manage files

//   2. Use the Team Explorer window to connect to source control

//   3. Use the Output window to see build output and other messages

//   4. Use the Error List window to view errors

//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project

//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file

C++ com 组件的使用的更多相关文章

  1. ExtJS 4.2 评分组件

    上一文章是扩展ExtJS自带的Date组件.在这里将创建一个评分组件. 目录 1. 介绍 2. 示例 3. 资源下载 1. 介绍 代码参考的是 Sencha Touch 2上的一个RatingStar ...

  2. react组件的生命周期

    写在前面: 阅读了多遍文章之后,自己总结了一个.一遍加强记忆,和日后回顾. 一.实例化(初始化) var Button = React.createClass({ getInitialState: f ...

  3. react-router 组件式配置与对象式配置小区别

    1. react-router 对象式配置 和 组件式配置    组件式配置(Redirect) ----对应---- 对象式配置(onEnter钩子) IndexRedirect -----对应-- ...

  4. Angular2入门系列教程3-多个组件,主从关系

    上一篇 Angular2项目初体验-编写自己的第一个组件 好了,前面简单介绍了Angular2的基本开发,并且写了一个非常简单的组件,这篇文章我们将要学会编写多个组件并且有主从关系 现在,假设我们要做 ...

  5. Angular2入门系列教程2-项目初体验-编写自己的第一个组件

    上一篇 使用Angular-cli搭建Angular2开发环境 Angular2采用组件的编写模式,或者说,Angular2必须使用组件编写,没有组件,你甚至不能将Angular2项目启动起来 紧接着 ...

  6. .NET Core 首例 Office 开源跨平台组件(NPOI Core)

    前言 最近项目中,需要使用到 Excel 导出,找了一圈发现没有适用于 .NET Core的,不依赖Office和操作系统限制的 Office 组件,于是萌生了把 NPOI 适配并移植到 .NET C ...

  7. .NetCore中的日志(1)日志组件解析

    .NetCore中的日志(1)日志组件解析 0x00 问题的产生 日志记录功能在开发中很常用,可以记录程序运行的细节,也可以记录用户的行为.在之前开发时我一般都是用自己写的小工具来记录日志,输出目标包 ...

  8. BootStrap_02之全局样式及组件

    1.BootStrap指定的四种屏幕尺寸: ①超大PC屏幕--lg(large):w>=1200px: ②中等PC屏幕--md(medium):1200px>w>=992px: ③P ...

  9. ExtJS 4.2 组件介绍

    目录 1. 介绍 1.1 说明 1.2 组件分类 1.3 组件名称 1.4 组件结构 2. 组件的创建方式 2.1 Ext.create()创建 2.2 xtype创建 1. 介绍 1.1 说明 Ex ...

  10. ExtJS 4.2 组件的查找方式

    组件创建了,就有方法找到这些组件.在DOM.Jquery都有各自的方法查找元素/组件,ExtJS也有自己独特的方式查找组件.元素.本次从全局查找.容器内查找.form表单查找.通用组件等4个方面介绍组 ...

随机推荐

  1. XDFZOI 月赛 201905 Sliver

    组题人自己组完过后,才发现自己还是太弱了... T1 简单模拟. 按照游戏规则直接模拟显然是不明智的,所以我们可以像石头剪刀布一样,将判断改变为检验. 同时,我们发现,一共只有48种牌,所以我们可以直 ...

  2. CTF-Decrypt-the-Message-writeup

    Decrypt-the-Message 题目信息: 解密这段信息! 附件: The life that I have Is all that I have And the life that I ha ...

  3. H3C交换机常用命令

    选择多个端口: interface range ethernet 1/0/1 to ethernet 1/0/12 vlan-interface1 常用命令 密码修改:  查看是否有相应的用户名:di ...

  4. 【论文阅读】套娃之 Blog for DMP Dynamic Movement Primitives

    前言:原笔记Notion链接:https://www.notion.so/Blog-for-DMP-d34e83c05eb944ba989fc8bf9b0c0f7b 如有格式显示问题等请点击此处查看 ...

  5. 【论文阅读】Motion Planning through policy search

    想着CSDN还是不适合做论文类的笔记,那里就当做技术/系统笔记区,博客园就专心搞看论文的笔记和一些想法好了,[]以后中框号中间的都算作是自己的内心OS 有时候可能是问题,有时候可能是自问自答,毕竟是笔 ...

  6. HTML5-CSS(二)

    一. CSS  文本样式 1.font-size p { font-size: 50px;}解释:设置文本的大小. xx-small.x-small.small.medium.large.x-larg ...

  7. Unittest方法 -- 测试套件

    TestSuite 测试固件 一. import unittestclass F6(unittest.TestCase): def setUp(self): pass def tearDown(sel ...

  8. CentOS下配置Nginx实现动静分离实例

    测试环境: CentOS Linux release 7.6 PHP 7.2.32 两台服务器:192.168.1.109(Nginx),192.168.1.118(Apache) 1. 安装配置19 ...

  9. mybatis的增删改查返回值小析(六)

    本文验证了通过mybatis访问数据库时的,增删改查的返回值情况. 直接看代码. 1.service层 /** *@Author: Administrator on 2020/3/12 15:15 * ...

  10. 用好Git stash,助你事半功倍

    git stash: 用法:git stash list [<选项>] 或:git stash show [<选项>] [<stash>] 或:git stash ...