// 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

最新文章

  1. [No00000D]word如何批量删除超链接 怎么去掉网址保留文字
  2. td的title属性
  3. 收到远程通知,怎么区分是点击通知栏提醒进去的还是在foreground收到的通知?
  4. WAMPSERVER多站点配置
  5. iOS-动画效果(首尾式动画,代码快动画,核心动画,序列帧动画)
  6. 使用dnspod进行简单的HTTP dns解析(防劫持)
  7. JavaScript navigator 对象(转)
  8. AngularJS 学习笔记(1)
  9. 添加三维动画 demo
  10. C#验证码
  11. linux最常用命令
  12. django获取ajax的post复杂对象
  13. 简单用数组模拟顺序栈(c++版)适合新手
  14. java idea导入ecli项目
  15. python 项目启动路径自动添加
  16. 4、NFS
  17. python第三十七天--异常--socket
  18. html的textarea默认文案实现换行
  19. 两个不能同时共存的条件orWhere查询
  20. const修饰的成员是类成员,还是实例成员?

热门文章

  1. 利用C语言判定用户输入数据从而给出结果(利用判定用户体重范围)同求最优解!!!
  2. 小哈学Python ----XML
  3. DNS部署与安全
  4. 洛谷P5463 小鱼比可爱(加强版) 题解
  5. python使用笔记17--异常处理
  6. Jmeter常见报错信息: ERROR - jmeter.protocol.http.proxy.ProxyControl: Could not initialise key store java.io.IOException: Cannot run program &quot;keytool&quot;
  7. [刘阳Java]_美团点评2018届校招面试总结_Java后台开发【转载】
  8. 初探SpringRetry机制
  9. python -- 面向对象编程(类、对象)
  10. Leetcode:面试题68 - II. 二叉树的最近公共祖先