Misc.h
上传用户:hy_wanghao
上传日期:2007-01-08
资源大小:279k
文件大小:4k
- #if !defined(AFX_MISC_H__20001226_08EE_84E5_C38A_0080AD509054__INCLUDED_)
- #define AFX_MISC_H__20001226_08EE_84E5_C38A_0080AD509054__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- //
- // Types and constants
- //
- // ADFView defined SHCONTF flag
- #define SHCONTF_INCLUDEDELETED 2048
- // Constants defining where in the shared
- // ImageList control the icons are placed.
- typedef enum
- {
- ICON_INDEX_ROOT = 0,
- ICON_INDEX_FOLDER,
- ICON_INDEX_FOLDER_OPEN,
- ICON_INDEX_FILE,
- } ICONINDEX;
- // Constants that tell us the order of
- // columns in the ListView control.
- typedef enum
- {
- COL_NAME = 0,
- COL_SIZE,
- COL_TYPE,
- COL_TIME,
- COL_ATTRIBS,
- } LISTVIEW_COLUMNS;
- // The internal tag that identifies our PIDL structure.
- // It's only used for debugging purposes.
- enum { PIDL_TAG = 0xBC };
- // The types of PIDL data we handle. So far, only files
- // and folders.
- typedef enum tagPIDLTYPE
- {
- PT_FOLDER = 0x01,
- PT_FILE = 0x02,
- PT_UNKNOWN = 0x04,
- } PIDLTYPE;
- // Our EntryFlags enumeration. It defines additional flags
- // for a file/folder.
- // It is a bitfield.
- typedef enum
- {
- EF_DELETED = 0x00000001, // The file is deleted
- } ENTRYFLAGS;
- // Our PIDL data structure; used through-out this
- // namespace extension.
- typedef struct tagPIDLDATA
- {
- // SHITEMID
- WORD cb;
- // Type identifiers
- BYTE tag;
- PIDLTYPE type;
- // File related entries..
- TCHAR szName[MAXNAMELEN+1];
- TCHAR szComment[MAXCMMTLEN+1];
- int iDosType;
- TCHAR szType[16];
- SYSTEMTIME ftTime;
- DWORD dwSize;
- DWORD dwAccess;
- DWORD dwEntryFlags;
- } PIDLDATA;
- typedef UNALIGNED PIDLDATA * LPPIDLDATA;
- typedef const UNALIGNED PIDLDATA * LPCPIDLDATA;
- #define pidl_cast(pidl) reinterpret_cast<LPCPIDLDATA>(pidl)
- //
- // Helper classes
- //
- // Stack based string buffer. Loads strings from the application resource.
- template<int nSize>
- class CResString
- {
- public:
- CResString()
- {
- m_szStr[0] = _T(' ');
- }
- CResString(UINT ID)
- {
- LoadString(ID);
- }
- ATLINLINE void LoadString(UINT ID)
- {
- ::LoadString(_Module.GetResourceInstance(), ID, m_szStr, lengthof(m_szStr));
- }
- operator LPTSTR() const { return (LPTSTR)m_szStr; };
- private:
- TCHAR m_szStr[nSize];
- };
- // A little hourglass helper
- class CWaitCursor
- {
- public:
- HCURSOR m_hOrigCursor;
- CWaitCursor()
- {
- m_hOrigCursor = ::SetCursor(::LoadCursor(0,IDC_WAIT));
- }
- ~CWaitCursor()
- {
- ::SetCursor(m_hOrigCursor);
- }
- };
- //
- // PIDLDATA access functions
- //
- void PidlGetFullPath(LPTSTR szPath, LPCITEMIDLIST pidl, LPCTSTR cSep=_T("/"));
- void PidlGetName(LPTSTR szName, LPCITEMIDLIST pidl);
- void PidlGetFilePath(LPTSTR pstrPath, LPCITEMIDLIST pidl, LPCTSTR cSep=_T("/"));
- PIDLTYPE PidlGetType(LPCITEMIDLIST pidl);
- //
- // Misc functions
- //
- BOOL CreateImageLists();
- //
- // Amiga Device helper functions
- //
- HRESULT OpenAmigaDevice(LPCTSTR pstrDevPath,
- BOOL bReadOnly,
- LPCITEMIDLIST pidlStartFolder,
- CAdfDevice &dev,
- CAdfVolume &vol);
- //
- // Trace functions
- //
- #ifdef _DEBUG
- LPTSTR DbgGetCF(CLIPFORMAT cf);
- LPTSTR DbgGetPidlPath(LPCITEMIDLIST pidl);
- LPTSTR DbgGetIID(REFIID iid);
- #else
- #define DbgGetCF
- #define DbgGetPidlPath
- #define DbgGetIID
- #endif
- #endif // !defined(AFX_MISC_H__20001226_08EE_84E5_C38A_0080AD509054__INCLUDED_)