⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proppage.h

📁 outlook 插件 在outlook 中添加弹出试菜单
💻 H
字号:

////////////////////////////////////////////////////////////////////////////
//	Copyright : Amit Dey 2002
//
//	Email :amitdey@joymail.com
//
//	This code may be used in compiled form in any way you desire. This
//	file may be redistributed unmodified by any means PROVIDING it is 
//	not sold for profit without the authors written consent, and 
//	providing that this notice and the authors name is included.
//
//	This file is provided 'as is' with no expressed or implied warranty.
//	The author accepts no liability if it causes any damage to your computer.
//
//	Do expect bugs.
//	Please let me know of any bugs/mods/improvements.
//	and I will try to fix/incorporate them into this file.
//	Enjoy!
//
//	Description : Outlook2K Addin 
////////////////////////////////////////////////////////////////////////////

// PropPage.h : Declaration of the CPropPage

#ifndef __PROPPAGE_H_
#define __PROPPAGE_H_

#include "resource.h"       // main symbols
#include <atlctl.h>
#import "C:\\Program Files\\Microsoft Office\\OFFICE11\\msoutl.olb" raw_interfaces_only
#include "atlcontrols.h"
using namespace ATLControls;
/////////////////////////////////////////////////////////////////////////////
// CPropPage
class ATL_NO_VTABLE CPropPage : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public IDispatchImpl<IPropPage, &IID_IPropPage, &LIBID_OUTLOOKADDINLib>,
	public CComCompositeControl<CPropPage>,
	public IPersistStreamInitImpl<CPropPage>,
	public IOleControlImpl<CPropPage>,
	public IOleObjectImpl<CPropPage>,
	public IOleInPlaceActiveObjectImpl<CPropPage>,
	public IViewObjectExImpl<CPropPage>,
	public IOleInPlaceObjectWindowlessImpl<CPropPage>,
	public IPersistStorageImpl<CPropPage>,
	public ISpecifyPropertyPagesImpl<CPropPage>,
	public IQuickActivateImpl<CPropPage>,
	public IDataObjectImpl<CPropPage>,
	public IProvideClassInfo2Impl<&CLSID_PropPage, NULL, &LIBID_OUTLOOKADDINLib>,
	public CComCoClass<CPropPage, &CLSID_PropPage>,
	public IPersistPropertyBagImpl<CPropPage>,
    public IDispatchImpl<PropertyPage,&__uuidof(PropertyPage),&LIBID_OUTLOOKADDINLib>
{
public:
	CPropPage()
	{
		m_bWindowOnly = TRUE;
		CalcExtent(m_sizeExtent);
	}

DECLARE_REGISTRY_RESOURCEID(IDR_PROPPAGE)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CPropPage)
	COM_INTERFACE_ENTRY(IPropPage)
	COM_INTERFACE_ENTRY2(IDispatch,IPropPage)
	COM_INTERFACE_ENTRY(IViewObjectEx)
	COM_INTERFACE_ENTRY(IViewObject2)
	COM_INTERFACE_ENTRY(IViewObject)
	COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
	COM_INTERFACE_ENTRY(IOleInPlaceObject)
	COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
	COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
	COM_INTERFACE_ENTRY(IOleControl)
	COM_INTERFACE_ENTRY(IOleObject)
	COM_INTERFACE_ENTRY(IPersistStreamInit)
	COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
	COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
	COM_INTERFACE_ENTRY(IQuickActivate)
	COM_INTERFACE_ENTRY(IPersistStorage)
	COM_INTERFACE_ENTRY(IDataObject)
	COM_INTERFACE_ENTRY(IProvideClassInfo)
	COM_INTERFACE_ENTRY(IProvideClassInfo2)
	COM_INTERFACE_ENTRY(IPersistPropertyBag) 
	COM_INTERFACE_ENTRY(Outlook::PropertyPage) 
END_COM_MAP()

BEGIN_PROP_MAP(CPropPage)
	PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
	PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
	// Example entries
	// PROP_ENTRY("Property Description", dispid, clsid)
	// PROP_PAGE(CLSID_StockColorPage)
END_PROP_MAP()

BEGIN_MSG_MAP(CPropPage)
CHAIN_MSG_MAP(CComCompositeControl<CPropPage>)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_HANDLER(IDC_BLUE, BN_CLICKED, OnClickedBlue)
COMMAND_HANDLER(IDC_GREEN, BN_CLICKED, OnClickedGreen)
END_MSG_MAP()
// Handler prototypes:
//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

BEGIN_SINK_MAP(CPropPage)
	//Make sure the Event Handlers have __stdcall calling convention
END_SINK_MAP()

STDMETHOD(GetControlInfo)(LPCONTROLINFO pCI);
STDMETHOD(SetClientSite)(IOleClientSite *pSite);

	STDMETHOD(OnAmbientPropertyChange)(DISPID dispid)
	{
		if (dispid == DISPID_AMBIENT_BACKCOLOR)
		{
		//	SetBackgroundColorFromAmbient();
		//	FireViewChange();
		}
		return IOleControlImpl<CPropPage>::OnAmbientPropertyChange(dispid);
	}



// IViewObjectEx
	DECLARE_VIEW_STATUS(0)

// IPropPage
public:

	enum { IDD = IDD_PROPPAGE };
// PropertyPage
	STDMETHOD(GetPageInfo)(BSTR * HelpFile, LONG * HelpContext);
	STDMETHOD(get_Dirty)(VARIANT_BOOL * Dirty);
	STDMETHOD(Apply)();

	private:
		CComVariant m_fDirty;
		CComPtr<Outlook::PropertyPageSite> m_pPropPageSite; 


	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
	{
		// TODO : Add Code for message handler. Call DefWindowProc if necessary.		CWindow pWnd ;
		pWnd.Attach(GetDlgItem(IDC_RED));
		ATLASSERT(pWnd);
		CButton pButton =pWnd.Detach();  
		pButton.SetCheck(1);
		return 0;
	}
	LRESULT OnClickedBlue(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
	{
		// TODO : Add Code for control notification handler.		m_fDirty = true;
		m_pPropPageSite->OnStatusChange();
		return 0;
	}
	LRESULT OnClickedGreen(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
	{
		// TODO : Add Code for control notification handler.		return 0;
	}
};

#endif //__PROPPAGE_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -