#include "..\server\server.h"//包含组建头文件
//三个接口
const IID IID_IQuan = {0xD8F43E2D,0xA5E2,0x4860,{0xAB,0xBF,0x99,0x59,0x46,0x93,0x8B,0xF1}};
const IID IID_IQuanInt2 = {0x8EAAFD88,0xF503,0x4E64,{0x87,0xFF,0x03,0x6E,0xF2,0x65,0x07,0x04}};
const IID IID_IQuanInt3 = {0xA3838B9E,0xC925,0x443A,{0xBD,0x6E,0x1F,0x46,0x5E,0x33,0x0E,0x1D}};
const IID LIBID_SERVERLib = {0x2C033624,0x7586,0x4649,{0xB2,0xB1,0x92,0x84,0xC5,0x82,0xD9,0x92}};
const CLSID CLSID_Quan = {0x423F2C1C,0xCC2C,0x4636,{0xB7,0x18,0x4A,0x6B,0x1A,0xA7,0x78,0xF9}};
// 声明一个HRESULT变量以及一个Simple_ATL接口的指针
HRESULT hr;
IQuan *IFirstATL = NULL;
// 现在初始化COM
hr = CoInitialize(0);
// 使用SUCCEEDED宏来看看我们是否能够获得接口的指针
if(SUCCEEDED(hr))
{
hr = CoCreateInstance( CLSID_Quan, NULL,
CLSCTX_INPROC_SERVER,
IID_IQuan, (void**) &IFirstATL);
MessageBox(NULL,"0",NULL,0);
// 如果成功了,那么调用AddNumbers方法
// 否则给用户显示一条适当的信息
if(SUCCEEDED(hr))
{
long ReturnValue;
IFirstATL->SerQuan1(ReturnValue);
::MessageBox(NULL,"1",NULL,0);
IFirstATL->Release();
}
else
{
MessageBox(NULL,"2",NULL,0);
}
}
// 卸载COM
CoUninitialize();