iopcshutdown_imp.cpp
来自「DCOM 上位机和嵌入式系统通信」· C++ 代码 · 共 90 行
CPP
90 行
#include "stdafx.h"
#include "CLIENT.h"
#include "iopcshutdown_imp.h"
IOPCShutdown_imp:: IOPCShutdown_imp()
{
mRefCount = 0;
}
///////////////////////////////////////
//
///////////////////////////////////////
IOPCShutdown_imp:: ~IOPCShutdown_imp()
{
}
///////////////////////////////////////
//
///////////////////////////////////////
STDMETHODIMP_(ULONG) IOPCShutdown_imp:: AddRef( void)
{
return ++mRefCount;
}
///////////////////////////////////////
//
///////////////////////////////////////
STDMETHODIMP_(ULONG) IOPCShutdown_imp:: Release( void)
{
ULONG currentCount = --mRefCount;
// If no references left for this object
if ( currentCount == 0)
{
// Then delete this group.
delete this;
}
return currentCount;
}
///////////////////////////////////////
//
///////////////////////////////////////
STDMETHODIMP IOPCShutdown_imp:: QueryInterface( REFIID iid, LPVOID* ppInterface)
{
if ( ppInterface == NULL)
return E_INVALIDARG;
if ( iid == IID_IUnknown )
*ppInterface = (IUnknown*) this;
else if ( iid == IID_IOPCShutdown)
{
*ppInterface = (IUnknown*) this;
}
else
{
*ppInterface = NULL;
}
if ( *ppInterface == NULL)
return E_NOINTERFACE;
AddRef();
return S_OK;
}
///////////////////////////////////////
//
///////////////////////////////////////
STDMETHODIMP IOPCShutdown_imp:: ShutdownRequest(
LPCWSTR szReason
)
{
CString szMess = "Reason unknown !!";
if(szReason)
szMess.Format("Reason is : %ls\n", szReason);
MessageBox(NULL,szMess,"Server ShutDown !",MB_OK|MB_ICONEXCLAMATION);
AfxGetApp()->m_pMainWnd->PostMessage(WM_COMMAND,ID_SERVER_DISCONNECT, 0);
return S_OK;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?