www.pudn.com > FTP¿Í»§¶Ë³ÌÐòµÄÔ´³ÌÐò.zip > FPCopy.h
// FPCopy.h : Declaration of the CFPCopy // Copyright © 1999 Ziff-Davis, Inc. // Written by Ignacio Alvarez #ifndef __FPCOPY_H_ #define __FPCOPY_H_ #include "resource.h" // main symbols DEFINE_SHLGUID(IID_ICopyHookA, 0x000214EFL, 0, 0); ///////////////////////////////////////////////////////////////////////////// // CFPCopy class ATL_NO_VTABLE CFPCopy : public CComObjectRootEx, public CComCoClass , public IFPCopy, public ICopyHook { public: CFPCopy() { } DECLARE_REGISTRY_RESOURCEID(IDR_FPCOPY) DECLARE_NOT_AGGREGATABLE(CFPCopy) DECLARE_PROTECT_FINAL_CONSTRUCT() BEGIN_COM_MAP(CFPCopy) COM_INTERFACE_ENTRY(IFPCopy) COM_INTERFACE_ENTRY(ICopyHook) END_COM_MAP() // IFPCopy public: // This method is called every time a folder is about to be copied, moved, or renamed STDMETHOD_(UINT,CopyCallback)(HWND hwnd, UINT wFunc, UINT wFlags, LPCSTR pszSrcFile, DWORD dwSrcAttribs, LPCSTR pszDestFile, DWORD dwDestAttribs) { switch(wFunc) { case FO_RENAME: // If a folder is being renamed if(IsFolderPointer(pszDestFile)) // Checks if the source is a Folder Pointer { if(!InStartMenu(pszDestFile)) // Checks if the destination is in the Start menu { // If it's not, it denies the operation by returning IDNO MessageBox(hwnd, "You can only have Folder Pointers inside the Start Menu.", "Folder Pointers", MB_ICONERROR | MB_OK); return IDNO; } } break; case FO_COPY: // If a folder is being copied case FO_MOVE: // Or moved if(IsFolderPointer(pszSrcFile)) // Checks if the source is a Folder Pointer { if(!InStartMenu(pszDestFile)) // Checks if the destination is in the Start Menu { // If it's not, it denies the operation by returning IDNO MessageBox(hwnd, "You can only have Folder Pointers inside the Start Menu.", "Folder Pointers", MB_ICONERROR | MB_OK); return IDNO; } } } return IDYES; } }; #endif //__FPCOPY_H_