?? comclient.cpp
字號:
// COMClient.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#import "../DotNetComponent/bin/debug/DotnetComponent.tlb"
using namespace std;
using namespace DotnetComponent;
int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hr;
hr = CoInitialize(NULL);
try
{
IWelcomePtr spWelcome;
hr = spWelcome.CreateInstance("Wrox.DotnetComponent"); // CoCreateInstance()
cout << spWelcome->Greeting("Bill") << endl;
IMathPtr spMath;
spMath = spWelcome; // QueryInterface()
long result = spMath->Add(4, 5);
cout << "result:" << result << endl;
}
catch (_com_error& e)
{
cout << e.ErrorMessage() << endl;
}
CoUninitialize();
return 0;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -