Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Internet Explorer AdBlock

, 17 Jan 2008
Internet Explorer AdBlock Add-on
ieadblock_src.zip
IE AdBlockPS
IE AdBlockps.def
IE AdBlock
AdBlockBand.rgs
AdBlockBHO.rgs
bin
XListCtrlSSDU.lib
XListCtrlSSRU.lib
IE AdBlock.def
IE AdBlock.rgs
res
bmpToolbar.bmp
checkboxes.bmp
icoSettings.ico
XListCtrl
checkboxes.bmp
// Redefinition protection
#ifndef ADBLOCKBAND_H
#define ADBLOCKBAND_H

//*********************************************************************
// INCLUDES
//*********************************************************************

#include "resource.h"       // main symbols

#include "IEAdBlock.h"
#include "AdBlockToolBarCtrl.h"

#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif

//*********************************************************************
// DEFINES
//*********************************************************************

#define TB_MIN_SIZE_X   10
#define TB_MIN_SIZE_Y   10

#define TB_MAX_SIZE_Y   25

//*********************************************************************
// CAdBlockBand
//*********************************************************************

class ATL_NO_VTABLE CAdBlockBand :
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CAdBlockBand, &CLSID_AdBlockBand>,
	public IObjectWithSiteImpl<CAdBlockBand>,
	public IDispatchImpl<IAdBlockBand, &IID_IAdBlockBand, &LIBID_IEAdBlockLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
	public IInputObject,
	public IDeskBand
{
public:
	// Declarations
	DECLARE_REGISTRY_RESOURCEID(IDR_ADBLOCKBAND)

	DECLARE_NOT_AGGREGATABLE(CAdBlockBand)

	DECLARE_PROTECT_FINAL_CONSTRUCT()

	BEGIN_COM_MAP(CAdBlockBand)
		COM_INTERFACE_ENTRY(IAdBlockBand)
		COM_INTERFACE_ENTRY(IDispatch)
		COM_INTERFACE_ENTRY(IObjectWithSite)
		COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
		COM_INTERFACE_ENTRY(IDeskBand)
		COM_INTERFACE_ENTRY2(IOleWindow, IDeskBand)
		COM_INTERFACE_ENTRY2(IDockingWindow, IDeskBand)
	END_COM_MAP()

	// Constructor & destructor
	CAdBlockBand();

	// Functions
	HRESULT FinalConstruct();
	void FinalRelease();

	//IOleWindow methods
	STDMETHOD (GetWindow) (HWND*);
	STDMETHOD (ContextSensitiveHelp) (BOOL);

	//IDockingWindow methods
	STDMETHOD (ShowDW) (BOOL fShow);
	STDMETHOD (CloseDW) (DWORD dwReserved);
	STDMETHOD (ResizeBorderDW) (LPCRECT pRcBorder, IUnknown* pUnkToolbarSite, BOOL fReserved);

	//IDeskBand methods
	STDMETHOD (GetBandInfo) (DWORD, DWORD, DESKBANDINFO*);

	//IInputObject methods
	STDMETHOD (UIActivateIO) (BOOL, LPMSG);
	STDMETHOD (HasFocusIO) (void);
	STDMETHOD (TranslateAcceleratorIO) (LPMSG);

	//IObjectWithSite methods
	STDMETHOD (SetSite) (IUnknown*);
	STDMETHOD (GetSite) (REFIID, LPVOID*);

protected:
	// Functions
	HRESULT Initialize(IUnknown * pUnkSite);
	void	DeInitialize();
	bool	CreateToolWindow(void);
	void	FocusChange(bool bFocus);

	// Variables
	CComPtr<IInputObjectSite> m_spSite;
	CAdBlockToolBarCtrl m_wndToolBar;
	bool	m_bFocus;		
	HWND	m_hWndParent;
	DWORD	m_dwBandID;
	DWORD	m_dwViewMode;
	CWnd	m_wndReflectionWnd;
};

OBJECT_ENTRY_AUTO(__uuidof(AdBlockBand), CAdBlockBand)

// End of redefinition protection
#endif // ADBLOCKBAND_H

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

About the Author

Geert van Horrik
Software Developer CatenaLogic
Netherlands Netherlands
I am Geert van Horrik, and I have studied Computer Science in the Netherlands.
 
I love to write software using .NET (especially the combination of WPF and C#). I am also the lead developer of Catel, an open-source application development framework for WPF, Silverlight, WP7 and WinRT with the focus on MVVM.
 
I have my own company since January 1st 2007, called CatenaLogic. This company develops commercial and non-commercial software.
 
To download (or buy) applications I have written, visit my website: http://www.catenalogic.com
Follow on   Twitter

| Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 17 Jan 2008
Article Copyright 2008 by Geert van Horrik
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid