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

📄 pidlfunc.cpp

📁 3D reconstruction, medical image processing from colons, using intel image processing for based clas
💻 CPP
字号:
#include "stdafx.h"#include "pidlfunc.h"LPMALLOC g_pMalloc = NULL;void Pidl_Initialize(){	SHGetMalloc(&g_pMalloc);}void Pidl_CleanUp(){	if (g_pMalloc) {		g_pMalloc->Release();		g_pMalloc = NULL;	}}LPITEMIDLIST Pidl_Create(UINT cbSize){	LPITEMIDLIST pidl = NULL;	pidl = (LPITEMIDLIST) g_pMalloc->Alloc(cbSize);	if (pidl)		ZeroMemory(pidl, cbSize);	return pidl;}UINT Pidl_GetSize(LPCITEMIDLIST pidl){	UINT cbTotal = 0;	LPITEMIDLIST pidlTemp = (LPITEMIDLIST) pidl;	if (pidlTemp) {		while (pidlTemp->mkid.cb) {			cbTotal += pidlTemp->mkid.cb;			pidlTemp = Pidl_GetNextItem(pidlTemp);		}  		// Requires a 16 bit zero value for the NULL terminator		cbTotal += 2 * sizeof(BYTE);	}	return cbTotal;}LPITEMIDLIST Pidl_Copy(LPCITEMIDLIST pidlSource){	LPITEMIDLIST pidlTarget = NULL;	UINT cbSource = 0;	if (NULL == pidlSource)		return NULL;	//	// Allocate the new ITEMIDLIST	//	cbSource = Pidl_GetSize(pidlSource);	pidlTarget = (LPITEMIDLIST) g_pMalloc->Alloc(cbSource);	if (!pidlTarget)		return NULL;	//	// Copy the source to the target	//	CopyMemory(pidlTarget, pidlSource, cbSource);	return pidlTarget;}LPITEMIDLIST Pidl_Concatenate(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2){	LPITEMIDLIST pidlNew;	UINT cb1 = 0, cb2 = 0;	//	// Pidl1 can possibly be NULL if it points to the desktop.  Since we only	// need a single NULL terminator, we remove the extra 2 bytes from the	// size of the first ITEMIDLIST.	//	if (pidl1)		cb1 = Pidl_GetSize(pidl1) - (2 * sizeof(BYTE));	cb2 = Pidl_GetSize(pidl2);	//	// Create a new ITEMIDLIST that is the size of both pidl1 and pidl2, then	// copy pidl1 and pidl2 to the new list.	//	pidlNew = Pidl_Create(cb1 + cb2);	if (pidlNew) {		if(pidl1)   			CopyMemory(pidlNew, pidl1, cb1);		CopyMemory(((LPBYTE)pidlNew) + cb1, pidl2, cb2);	}	return pidlNew;}// iMode: 0 = REL, 1 = FQint Pidl_Compare(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2, int iMode){	UINT uSize1, uSize2;	if (pidl1 && pidl2) {		switch (iMode) {		case 0:			// REL			uSize1 = pidl1->mkid.cb;			uSize2 = pidl2->mkid.cb;			break;		case 1:			// FQ			uSize1 = Pidl_GetSize(pidl1);			uSize2 = Pidl_GetSize(pidl2);			break;		}		if ((uSize1 == uSize2) && !memcmp(pidl1, pidl2, uSize1))			return 0;		else			return 1;	}	return 1;		// 0 if equivalent, 1 otherwise}void Pidl_Free(LPITEMIDLIST pidl){	if (pidl)		g_pMalloc->Free(pidl);}

⌨️ 快捷键说明

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