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

📄 utility.h

📁 一个完整的IE插件的程序的源代码(有些参考价值)
💻 H
字号:
// utility.h
//
// @author christian oetterli
//

#ifndef __UTILITY_H__
#define __UTILITY_H__

// @returns the last error message.
CString getLastErrorMessage();

// class for safe init/uninit of com.
class CComInit
{
public:
	// initializes com.
	CComInit();

	// uninitializes com.
	virtual ~CComInit();
};

// POINT wrapper.

class CPoint : public POINT
{
public:
	CPoint();
	CPoint(const POINTL &p);
	CPoint(long newX, long newY);
	CPoint(const POINT &src);

	// offset the point.
	// @param cx distance in x.
	// @param cy distance in y.
	void move(int cx, int cy = 0);
};

// RECT wrapper.

class CRect : public RECT
{
public:
	CRect();
	CRect(long newLeft, long newTop, long newRight, long newBottom);
	CRect(const RECT &src);
	CRect(POINT point, SIZE size);
	CRect(POINT leftTop, POINT rightBottom);
	CRect(LPCRECT src);
	CRect(RECTL src);
	operator LPRECT();
	operator LPCRECT() const;
	const RECT& operator =(const RECT& src);
	long height() const;
	long width() const;
	CPoint leftTop() const;
	CPoint rightBottom() const;
	
	// check wheter or not a point lies within this rect.
	// @param p point to check.
	// @return true if point lies withith this rect.
	bool isPointInMe(CPoint p) const;
};

// SIZE wrapper.

class CSize : public SIZE
{
public:
	CSize();
	CSize(long newCx, long newCy);
	CSize(const SIZE &src);
};

// vector of CRect.

class CRects : public vector<CRect>
{
};

// vector of variants.

class CParams : public vector<variant>  
{
public:
	CParams();
	CParams(variant p);
	CParams(variant p1, variant p2);
	CParams(variant p1, variant p2, variant p3);
};

// vector of HICON.

class CIcons : public vector<HICON>
{
public:
	// detroys containing icons and clears this.
	void destroy();
	virtual ~CIcons();
};

// HDC wrapper

class CDC
{
public:
	CDC();
	CDC(HDC newDC);
	CDC(const CDC &src);

	// see MFCs FillSolidRect
	void fillSolidRect(LPCRECT rect, COLORREF color);
	// see MFCs Draw3DRect
	void draw3dRect(LPCRECT rect, COLORREF colorLeftTop, COLORREF colorRightBottom);

	HDC getDC() const;
	operator HDC() const;

protected:
	HDC dc;
};

// registers class for necessary component categories and Internet Explorer registry entries.
// @param clsid class id that is a Internet Explorer Band.
// @param doRegister true if wants to register, false if wants to unregister.
void registerToolbarBand(const CLSID &clsid, bool doRegister);

#endif //__UTILITY_H__

⌨️ 快捷键说明

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