C++ com 组件的使用
// 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 组件的使用的更多相关文章
- ExtJS 4.2 评分组件
上一文章是扩展ExtJS自带的Date组件.在这里将创建一个评分组件. 目录 1. 介绍 2. 示例 3. 资源下载 1. 介绍 代码参考的是 Sencha Touch 2上的一个RatingStar ...
- react组件的生命周期
写在前面: 阅读了多遍文章之后,自己总结了一个.一遍加强记忆,和日后回顾. 一.实例化(初始化) var Button = React.createClass({ getInitialState: f ...
- react-router 组件式配置与对象式配置小区别
1. react-router 对象式配置 和 组件式配置 组件式配置(Redirect) ----对应---- 对象式配置(onEnter钩子) IndexRedirect -----对应-- ...
- Angular2入门系列教程3-多个组件,主从关系
上一篇 Angular2项目初体验-编写自己的第一个组件 好了,前面简单介绍了Angular2的基本开发,并且写了一个非常简单的组件,这篇文章我们将要学会编写多个组件并且有主从关系 现在,假设我们要做 ...
- Angular2入门系列教程2-项目初体验-编写自己的第一个组件
上一篇 使用Angular-cli搭建Angular2开发环境 Angular2采用组件的编写模式,或者说,Angular2必须使用组件编写,没有组件,你甚至不能将Angular2项目启动起来 紧接着 ...
- .NET Core 首例 Office 开源跨平台组件(NPOI Core)
前言 最近项目中,需要使用到 Excel 导出,找了一圈发现没有适用于 .NET Core的,不依赖Office和操作系统限制的 Office 组件,于是萌生了把 NPOI 适配并移植到 .NET C ...
- .NetCore中的日志(1)日志组件解析
.NetCore中的日志(1)日志组件解析 0x00 问题的产生 日志记录功能在开发中很常用,可以记录程序运行的细节,也可以记录用户的行为.在之前开发时我一般都是用自己写的小工具来记录日志,输出目标包 ...
- BootStrap_02之全局样式及组件
1.BootStrap指定的四种屏幕尺寸: ①超大PC屏幕--lg(large):w>=1200px: ②中等PC屏幕--md(medium):1200px>w>=992px: ③P ...
- ExtJS 4.2 组件介绍
目录 1. 介绍 1.1 说明 1.2 组件分类 1.3 组件名称 1.4 组件结构 2. 组件的创建方式 2.1 Ext.create()创建 2.2 xtype创建 1. 介绍 1.1 说明 Ex ...
- ExtJS 4.2 组件的查找方式
组件创建了,就有方法找到这些组件.在DOM.Jquery都有各自的方法查找元素/组件,ExtJS也有自己独特的方式查找组件.元素.本次从全局查找.容器内查找.form表单查找.通用组件等4个方面介绍组 ...
随机推荐
- vmware使用U盘安装系统
创建好系统 创建一个新的硬盘,选择"physicalDrive1" 如果识别不到physicalDrive 1,使用下面的方法. 1.在本机的服务里面启用下面的服务. 2.重启 V ...
- 锐捷路由器 RSR20-X-28
学习帮助视频 Ruijie#show run | in natip nat outsideip nat insideip nat pool NAT_POOL prefix-length 24ip na ...
- MVC框架介绍分析
相信绝大多数学习过Javaweb的人都知道一个系统的模式--Spring模式,以这么模式中为基础,衍生出各种各样的新的模式,其中最重要的就是Spring下的Spring MVC MVC是Xerox P ...
- Kubernetes部署-二进制方式
环境配置 一.系统环境 序号 用途 系统 Docker版本 IP地址 1 Master CentOS Linux release 7.6.1810 (Core) 19.03.4 192.168.0.1 ...
- 基于SSM框架的旅游网站
介绍:spring+springmvc+mybatis三大框架,mysql数据库 功能结构图: 效果截图: 数据库表: CREATE TABLE `t_admin` ( `id` int(11) NO ...
- 解决远程连接服务器数据库报错:Host ‘XXXXXX’ is blocked because of many connection errors
参考:https://blog.csdn.net/li_li_lin/article/details/72764683和 https://blog.csdn.net/zaishijizhidian/a ...
- Python多线程爬取某网站表情包
# 爬取网络图片import requestsfrom lxml import etreefrom urllib import requestfrom queue import Queue # 导入队 ...
- PAT甲级:1064 Complete Binary Search Tree (30分)
PAT甲级:1064 Complete Binary Search Tree (30分) 题干 A Binary Search Tree (BST) is recursively defined as ...
- windows使用nvm管理node不同版本
最近项目需要升级,新技术需要的node版本较高,而新node不兼容旧版本node,而原项目仍需要继续维护,所以就需要在本地有多个版本的node,基本原理是在环境配置中修改系统变量node的版本文件夹路 ...
- 最长公共子序列问题(LCS)——Python实现
# 最长公共子序列问题 # 作用:求两个序列的最长公共子序列 # 输入:两个字符串数组:A和B # 输出:最长公共子序列的长度和序列 def LCS(A,B): print('输入字符串数组A', ...