Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenfiledefext.h
Go to the documentation of this file.
00001 /* 00002 * Provides default file shell extension 00003 * 00004 * Copyright 2012 Rafal Harabien 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #ifndef _FILE_DEF_EXT_H_ 00022 #define _FILE_DEF_EXT_H_ 00023 00024 class CFileVersionInfo 00025 { 00026 private: 00027 PVOID m_pInfo; 00028 WORD m_wLang, m_wCode; 00029 WCHAR m_wszLang[64]; 00030 00031 typedef struct _LANGANDCODEPAGE_ 00032 { 00033 WORD wLang; 00034 WORD wCode; 00035 } LANGANDCODEPAGE, *LPLANGANDCODEPAGE; 00036 00037 public: 00038 inline CFileVersionInfo(): 00039 m_pInfo(NULL), m_wLang(0), m_wCode(0) 00040 { 00041 m_wszLang[0] = L'\0'; 00042 } 00043 00044 inline ~CFileVersionInfo() 00045 { 00046 if (m_pInfo) 00047 HeapFree(GetProcessHeap(), 0, m_pInfo); 00048 } 00049 00050 BOOL Load(LPCWSTR pwszPath); 00051 LPCWSTR GetString(LPCWSTR pwszName); 00052 VS_FIXEDFILEINFO *GetFixedInfo(); 00053 LPCWSTR GetLangName(); 00054 }; 00055 00056 class CFileDefExt : 00057 public CComCoClass<CFileDefExt, &CLSID_ShellFileDefExt>, 00058 public CComObjectRootEx<CComMultiThreadModelNoCS>, 00059 public IShellExtInit, 00060 public IContextMenu, 00061 public IShellPropSheetExt, 00062 public IObjectWithSite 00063 { 00064 private: 00065 VOID InitOpensWithField(HWND hwndDlg); 00066 BOOL InitFileType(HWND hwndDlg); 00067 BOOL InitFilePath(HWND hwndDlg); 00068 static BOOL GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult); 00069 BOOL InitFileAttr(HWND hwndDlg); 00070 BOOL InitGeneralPage(HWND hwndDlg); 00071 BOOL SetVersionLabel(HWND hwndDlg, DWORD idCtrl, LPCWSTR pwszName); 00072 BOOL AddVersionString(HWND hwndDlg, LPCWSTR pwszName); 00073 BOOL InitVersionPage(HWND hwndDlg); 00074 static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 00075 static INT_PTR CALLBACK VersionPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 00076 BOOL CountFolderAndFiles(LPWSTR pwszBuf, UINT cchBufMax); 00077 00078 WCHAR m_wszPath[MAX_PATH]; 00079 CFileVersionInfo m_VerInfo; 00080 BOOL m_bDir; 00081 00082 DWORD m_cFiles; 00083 DWORD m_cFolders; 00084 ULARGE_INTEGER m_DirSize; 00085 00086 public: 00087 CFileDefExt(); 00088 ~CFileDefExt(); 00089 00090 // IShellExtInit 00091 virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID); 00092 00093 // IContextMenu 00094 virtual HRESULT WINAPI QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); 00095 virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpici); 00096 virtual HRESULT WINAPI GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax); 00097 00098 // IShellPropSheetExt 00099 virtual HRESULT WINAPI AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam); 00100 virtual HRESULT WINAPI ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam); 00101 00102 // IObjectWithSite 00103 virtual HRESULT WINAPI SetSite(IUnknown *punk); 00104 virtual HRESULT WINAPI GetSite(REFIID iid, void **ppvSite); 00105 00106 DECLARE_REGISTRY_RESOURCEID(IDR_FILEDEFEXT) 00107 DECLARE_NOT_AGGREGATABLE(CFileDefExt) 00108 00109 DECLARE_PROTECT_FINAL_CONSTRUCT() 00110 00111 BEGIN_COM_MAP(CFileDefExt) 00112 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) 00113 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) 00114 COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt) 00115 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) 00116 END_COM_MAP() 00117 }; 00118 00119 #endif // _FILE_DEF_EXT_H_ Generated on Sat May 26 2012 04:24:55 for ReactOS by
1.7.6.1
|