IMyObj.cpp
上传用户:weisheen
上传日期:2022-07-09
资源大小:19390k
文件大小:1k
- // IMyObj.cpp : Implementation of CIMyObj
- #include "stdafx.h"
- #include "IUnknownDemo.h"
- #include "IMyObj.h"
- /////////////////////////////////////////////////////////////////////////////
- // CIMyObj
- STDMETHODIMP CIMyObj::add(int a, int b, int *c)
- {
- *c=a+b;
- return S_OK;
- }
- STDMETHODIMP CIMyObj::hello(BSTR name, BSTR* result)
- {
- *result=::SysAllocString(L"hello the world");
- return S_OK;
- }
- STDMETHODIMP CIMyObj::sub(VARIANT a, VARIANT b, VARIANT *c)
- {
- // TODO: Add your implementation code here
- if(a.vt!=VT_I4 || b.vt!=VT_I4)
- {
- return S_FALSE;
- }
- c->lVal=a.lVal-b.lVal;
- return S_OK;
- }