MyLog.cpp
上传用户:weisheen
上传日期:2022-07-09
资源大小:19390k
文件大小:2k
- // MyLog.cpp: implementation of the MyLog class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "test.h"
- #include "MyLog.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- MyLog::MyLog()
- {
- }
- MyLog::~MyLog()
- {
- }
- STDMETHODIMP MyLog::WriteLog(BSTR message)
- {
- CString msg(message);
- ::SysFreeString(message);
- AfxMessageBox(msg);
- return S_OK;
- }
- STDMETHODIMP MyLog::GetTypeInfoCount(UINT __RPC_FAR *pctinfo)
- {
- return S_FALSE;
- }
-
- STDMETHODIMP MyLog::GetTypeInfo(
- UINT iTInfo,
- LCID lcid,
- ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo)
- {
- return S_FALSE;
- }
- STDMETHODIMP MyLog::GetIDsOfNames(
- REFIID riid,
- LPOLESTR __RPC_FAR *rgszNames,
- UINT cNames,
- LCID lcid,
- DISPID __RPC_FAR *rgDispId)
- {
- return S_FALSE;
- }
- STDMETHODIMP MyLog::Invoke(
- DISPID dispIdMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- DISPPARAMS __RPC_FAR *pDispParams,
- VARIANT __RPC_FAR *pVarResult,
- EXCEPINFO __RPC_FAR *pExcepInfo,
- UINT __RPC_FAR *puArgErr)
- {
- if(dispIdMember==1)
- {
- BSTR bBuffer=::SysAllocString(pDispParams->rgvarg[0].bstrVal);
- SysFreeString(pDispParams->rgvarg[0].bstrVal);
- return this->WriteLog(bBuffer);
- }
- else
- {
- *puArgErr=1;
- return S_FALSE;
- }
- }
- STDMETHODIMP MyLog::QueryInterface(
- REFIID riid,
- void __RPC_FAR *__RPC_FAR *ppvObject)
- {
- return S_FALSE;
- }
- STDMETHODIMP_(ULONG) MyLog::AddRef( void)
- {
- return 1;
- }
- STDMETHODIMP_(ULONG) MyLog::Release( void)
- {
- return 1;
- }