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

📄 extracticon.cpp

📁 Drive.dll is a dll that creates a drive to system directoryor drive similar to existing drives such
💻 CPP
字号:

#include <windows.h>
#include <shlobj.h>

#include "EnumIDL.h"
#include "ExtractIcon.h"
#include "ShellView.h"
#include "resource.h"

extern UINT			g_uiRefThisDll;
extern HINSTANCE	g_hInstance;
extern HIMAGELIST	g_hImageListSmall;
extern HIMAGELIST	g_hImageListLarge;

CExtractIcon::CExtractIcon(LPCITEMIDLIST pidl)
{
	m_pPidlMgr = new CPidlMgr();

	m_pidl = m_pPidlMgr->Copy(pidl);

	m_uiRefCount = 1;

	g_uiRefThisDll++;
}

CExtractIcon::~CExtractIcon()
{
	if(m_pidl)
	{
		m_pPidlMgr->Delete(m_pidl);
		m_pidl = NULL;
	}

	if(m_pPidlMgr)
	{
		delete m_pPidlMgr;
	}

	g_uiRefThisDll--;
}

///////////////////////////////////////////////////////////
// IUnknown Implementation
//
STDMETHODIMP CExtractIcon::QueryInterface(REFIID riid, LPVOID *ppReturn)
{
	*ppReturn = NULL;

	//IUnknown
	if(IsEqualIID(riid, IID_IUnknown))
	{
		*ppReturn = this;
	}
	//IExtractIcon
	else if(IsEqualIID(riid, IID_IExtractIcon))
	{
		*ppReturn = (IExtractIcon*)this;
	}

	if(*ppReturn)
	{
		(*(LPUNKNOWN*)ppReturn)->AddRef();
		return S_OK;
	}

	return E_NOINTERFACE;
}                                             

STDMETHODIMP_(DWORD) CExtractIcon::AddRef()
{
	return ++m_uiRefCount;
}

STDMETHODIMP_(DWORD) CExtractIcon::Release()
{
	if(--m_uiRefCount == 0)
	{
		delete this;
		return 0;
	}

	return m_uiRefCount;
}

///////////////////////////////////////////////////////////
// IExtractIcon Implementation
// TODO : Modify to suit your needs
STDMETHODIMP CExtractIcon::GetIconLocation(  UINT uFlags, 
                                             LPTSTR szIconFile, 
                                             UINT cchMax, 
                                             LPINT piIndex, 
                                             LPUINT puFlags)
{
	return E_NOTIMPL;
}

// TODO : Modify to suit your needs
STDMETHODIMP CExtractIcon::Extract( LPCTSTR pszFile, UINT nIconIndex, 
									HICON *phiconLarge, HICON *phiconSmall, 
									UINT nIconSize)
{
	return E_NOTIMPL;
}

//EOF

⌨️ 快捷键说明

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