Click here to Skip to main content
15,892,965 members
Articles / Programming Languages / C++

Tips in Writing Namespace Extension (III) - Drag and Drop objects between System Namespace and your NSE

Rate me:
Please Sign up or sign in to vote.
4.73/5 (19 votes)
22 Feb 200617 min read 240.3K   2.1K   56  
An article on implementing drag and drop operation between your NSE and system namespace.
#ifndef _CNWSPIDLMGR_H_
#define _CNWSPIDLMGR_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

typedef	enum tagITEM_TYPE
{
	NWS_FOLDER=0x00000001,
	NWS_FILE=0x00000002,
}ITEM_TYPE;

typedef struct tagPIDLDATA
   {
   ITEM_TYPE type;
   TCHAR    szName[1];
   }PIDLDATA, FAR *LPPIDLDATA;

class CNWSPidlMgr
{
public:

	LPITEMIDLIST Create(ITEM_TYPE iItemType,LPTSTR szName);
	void Delete(LPITEMIDLIST pidl);
	LPITEMIDLIST GetNextItem(LPCITEMIDLIST pidl);
	LPITEMIDLIST GetLastItem(LPCITEMIDLIST pidl);
	UINT GetByteSize(LPCITEMIDLIST pidl);
	bool IsSingle(LPCITEMIDLIST pidl);
	LPITEMIDLIST Concatenate(LPCITEMIDLIST, LPCITEMIDLIST);
	LPITEMIDLIST Copy(LPCITEMIDLIST pidlSrc);
	
	// Retrieve encrypted file name (without the path)
	// The pidl MUST remain valid until the caller has finished with the returned string.
	HRESULT GetName(LPCITEMIDLIST,LPTSTR);

	// Retrieve the item type (see above)
	ITEM_TYPE GetItemType(LPCITEMIDLIST pidl);
	
	HRESULT GetFullName(LPCITEMIDLIST pidl,LPTSTR szFullName,DWORD *pdwLen); 
	BOOL  HasSubFolder(LPCITEMIDLIST pidl); 
	HRESULT GetItemAttributes(LPCITEMIDLIST pidl,USHORT iAttrNum,LPTSTR pszAttrOut);

private:
	LPPIDLDATA GetDataPointer(LPCITEMIDLIST);

};

#endif//_CNWSPIDLMGR_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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
China China
ZengXi is a SOHO guy. Her expertise includes ATL, COM, Web Service, XML, Database Systems and Information Security Technology. Now she is interested in Instant Messages softwares. She also enjoys her hobbies of reading books, listening music and watching cartoons.

Comments and Discussions