📄 cpgpextmodeless.cpp
字号:
////////////////////////////////////////////////////////////////////////////////
// File : cpgpextmodeless.cpp
//
// Copyright (C) 2002 PGP Corporation
//
// ABSTRACT
//
//
// Author: Satya S. Das
////////////////////////////////////////////////////////////////////////////////
#include "CPGPexch.h"
#include "CPGPExtModeless.h"
#include "pgpdebug.h"
#include "utils.h"
CPGPExtModeless::CPGPExtModeless()
{
#ifdef _DEBUG
ExchPluginTrace("CPGPExtModeless(%#x) (tid = %#x) - constructed\n",
this, GetCurrentThreadId());
#endif
m_ulRefCount = 1;
m_hWnd = NULL;
}
CPGPExtModeless::~CPGPExtModeless()
{
#ifdef _DEBUG
ExchPluginTrace("CPGPExtModeless(%#x) (tid = %#x) - destroyed\n",
this, GetCurrentThreadId());
#endif
pgpAssert(0 == m_ulRefCount);
int iRet = IsPlatform98OrME();
pgpAssert(-1 != iRet);//should not be any errors
if((-1 == iRet) || (1 == iRet))
goto cleanup;
//if our modeless window is still around
if((NULL != m_hWnd) && (0 != IsWindow(m_hWnd)))
{
MSG msgWndMsg={0};
BOOL bRet = TRUE;
//make sure our modeless window is done before returning to outllib
//if we do not do this module gets mapped out if outlook is running
//without the main window (such as via context menu -> send to) with
//system calling back into wndproc in la la land. this is an ugly
//hack to solve this problem but the only solution known - ssd
while(0 != (bRet = GetMessage(&msgWndMsg, m_hWnd, 0, 0)))
{
if(-1 == bRet)
break;
#ifdef _DEBUG
ExchPluginTrace("\t CPGPExtModeless(%#x) (tid = %#x) - got message for hwnd = %#x msg = %#x\n",
this, GetCurrentThreadId(), m_hWnd, msgWndMsg.message);
#endif
TranslateMessage(&msgWndMsg);
DispatchMessage(&msgWndMsg);
}
}
cleanup:
m_hWnd = NULL;
}
STDMETHODIMP CPGPExtModeless::QueryInterface(REFIID riid, void** ppvObj)
{
#ifdef _DEBUG
ExchPluginTrace("CPGPExtModeless(%#x) (tid = %#x) - QueryInterface\n",
this, GetCurrentThreadId());
#endif
HRESULT hrRet = S_OK;
LPUNKNOWN lpUnknown = NULL;
pgpAssert(NULL != ppvObj);
*ppvObj = NULL;
if((IID_IUnknown == riid) || (IID_IExchExtModeless == riid))
{
lpUnknown = (IExchExt*)this;
}
else
hrRet = E_NOINTERFACE;
if (NULL != lpUnknown)
{
*ppvObj = lpUnknown;
this->AddRef();
}
return hrRet;
}
STDMETHODIMP_(ULONG) CPGPExtModeless::AddRef()
{
#ifdef _DEBUG
ExchPluginTrace("CPGPExtModeless(%#x) (tid = %#x) - AddRef upping refcount to %d\n",
this, GetCurrentThreadId(), m_ulRefCount+1);
#endif
pgpAssert(0 != m_ulRefCount);//should not be on the path to destruction
//object resurrection not supported :) -ssd
m_ulRefCount++;
return m_ulRefCount;
}
STDMETHODIMP_(ULONG) CPGPExtModeless::Release()
{
#ifdef _DEBUG
ExchPluginTrace("CPGPExtModeless(%#x) (tid = %#x)- Release downing refcount to %d\n",
this, GetCurrentThreadId(), m_ulRefCount-1);
#endif
pgpAssert(0 != m_ulRefCount);//we only have one life
ULONG ulCount = --m_ulRefCount;
if (0 == ulCount)
delete this;
return ulCount;
}
STDMETHODIMP CPGPExtModeless::EnableModeless(BOOL bEnable)
{
#ifdef _DEBUG
ExchPluginTrace("CPGPExtModeless(%#x) (tid = %#x) - EnableModeless bEnable = %d\n",
this, GetCurrentThreadId(), bEnable);
#endif
return S_OK;
}
STDMETHODIMP CPGPExtModeless::TranslateAccelerator(LPMSG lpMsg)
{
#ifdef _DEBUG
ExchPluginTrace("CPGPExtModeless(%#x) (tid = %#x) - TranslateAccelerator hwnd = %#x msg = %#x\n",
this, GetCurrentThreadId(), lpMsg->hwnd, lpMsg->message);
#endif
//if we handle the message, we should return S_OK to prevent
//outlook from handling the same message.
return S_FALSE; //message was not handled by us. we do not do any funky
//stuff to steal messages fron outlook now - ssd
}
BOOL CPGPExtModeless::AddWindow(HWND hWnd)
{
#ifdef _DEBUG
ExchPluginTrace("CPGPExtModeless(%#x) (tid = %#x) - AddWindow hWnd = %#x \n",
this, GetCurrentThreadId(), hWnd);
#endif
m_hWnd = hWnd;
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -