|
// ComTest.cpp : コンソール アプリケーション用のエントリ ポイントの定義
//
#include "stdafx.h"
#include <lightbox.h>
#import "D:\WSC\CLLib\MyCom\Debug\MyCom.dll" no_namespace
inline void TESTHR(HRESULT x) {if FAILED(x) _com_issue_error(x);};
int main(int argc, char* argv[])
{
int nErr = 0;
IMyAPIPtr pApp = NULL;
_bstr_t Message("こんにちは !");
CoInitialize(NULL);
try {
TESTHR(pApp.CreateInstance(__uuidof(MyAPI)));
nErr++;
pApp->MsgBox(Message);
pApp.Release();
}
catch(_com_error &e) {
printf( "%s\n", (LPTSTR)(e.Description() ) );
if ( nErr > 0 ) {
pApp.Release();
}
}
CoUninitialize();
return 0;
}
| |