├── foptmgr.png ├── IEaddons.png ├── IEoptions.png ├── FolderOptionsX ├── FolderOptionsMgr │ ├── focus.bmp │ ├── fullrow.bmp │ ├── headers.bmp │ ├── reorder.bmp │ ├── FolderOptionsMgr.rc │ ├── FolderOptionsMgr.ico │ ├── stdafx.cpp │ ├── Resource.h │ ├── stdafx.h │ ├── helpers.h │ ├── FolderOptionsMgr.cpp │ └── FolderOptionsMgr.vcproj ├── FolderOptions │ ├── FolderOptions.rc │ ├── resource.h │ ├── FolderOptions.def │ ├── StdAfx.cpp │ ├── StdAfx.h │ ├── ExplorerBHO.rgs │ ├── FolderOptions.idl │ ├── FolderOptions.cpp │ ├── settings.h │ ├── ExplorerBHO.h │ ├── helpers.h │ ├── ExplorerBHO.cpp │ └── FolderOptions.vcproj └── FolderOptionsX.sln ├── README.md └── The Code Project Open License (CPOL) 1.02.md /foptmgr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T800G/FolderOptionsX/HEAD/foptmgr.png -------------------------------------------------------------------------------- /IEaddons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T800G/FolderOptionsX/HEAD/IEaddons.png -------------------------------------------------------------------------------- /IEoptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T800G/FolderOptionsX/HEAD/IEoptions.png -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/focus.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T800G/FolderOptionsX/HEAD/FolderOptionsX/FolderOptionsMgr/focus.bmp -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/fullrow.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T800G/FolderOptionsX/HEAD/FolderOptionsX/FolderOptionsMgr/fullrow.bmp -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/headers.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T800G/FolderOptionsX/HEAD/FolderOptionsX/FolderOptionsMgr/headers.bmp -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/reorder.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T800G/FolderOptionsX/HEAD/FolderOptionsX/FolderOptionsMgr/reorder.bmp -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/FolderOptions.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T800G/FolderOptionsX/HEAD/FolderOptionsX/FolderOptions/FolderOptions.rc -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/FolderOptionsMgr.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T800G/FolderOptionsX/HEAD/FolderOptionsX/FolderOptionsMgr/FolderOptionsMgr.rc -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/FolderOptionsMgr.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T800G/FolderOptionsX/HEAD/FolderOptionsX/FolderOptionsMgr/FolderOptionsMgr.ico -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/resource.h: -------------------------------------------------------------------------------- 1 | #ifndef IDC_STATIC 2 | #define IDC_STATIC (-1) 3 | #endif 4 | 5 | #define IDR_ExplorerBHO 102 6 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/FolderOptions.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllGetClassObject PRIVATE 4 | DllRegisterServer PRIVATE 5 | DllUnregisterServer PRIVATE 6 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // stdafx.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | #ifdef _ATL_STATIC_REGISTRY 8 | #include 9 | #endif 10 | 11 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // FolderOptions.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/StdAfx.h: -------------------------------------------------------------------------------- 1 | #ifndef __6B61DDCE_E7EE_43D2_8F13_F3E73836FE3F__INCLUDED_ 2 | #define __6B61DDCE_E7EE_43D2_8F13_F3E73836FE3F__INCLUDED_ 3 | #pragma once 4 | 5 | 6 | #define STRICT 7 | #ifndef _WIN32_WINNT 8 | #define _WIN32_WINNT _WIN32_WINNT_WIN7 9 | #endif 10 | #define _ATL_APARTMENT_THREADED 11 | 12 | #include 13 | extern CComModule _Module; 14 | #include 15 | 16 | #endif//__6B61DDCE_E7EE_43D2_8F13_F3E73836FE3F__INCLUDED) 17 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/ExplorerBHO.rgs: -------------------------------------------------------------------------------- 1 | HKLM 2 | { 3 | NoRemove Software 4 | { 5 | NoRemove Classes 6 | { 7 | NoRemove CLSID 8 | { 9 | ForceRemove {0AE87E97-08ED-4D43-ADA3-ADD3166FC4D2} = s 'Folder Options X' 10 | { 11 | InprocServer32 = s '%MODULE%' 12 | { 13 | val ThreadingModel = s 'Apartment' 14 | } 15 | } 16 | } 17 | } 18 | 19 | NoRemove Microsoft 20 | { 21 | NoRemove Windows 22 | { 23 | NoRemove CurrentVersion 24 | { 25 | NoRemove Explorer 26 | { 27 | NoRemove 'Browser Helper Objects' 28 | { 29 | ForceRemove {0AE87E97-08ED-4D43-ADA3-ADD3166FC4D2} 30 | { 31 | val NoInternetExplorer = d '1' 32 | } 33 | } 34 | } 35 | } 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/FolderOptions.idl: -------------------------------------------------------------------------------- 1 | // FolderOptions.idl : IDL source for FolderOptions.dll 2 | // 3 | 4 | // This file will be processed by the MIDL tool to 5 | // produce the type library (FolderOptions.tlb) and marshalling code. 6 | 7 | import "oaidl.idl"; 8 | import "ocidl.idl"; 9 | 10 | [ 11 | object, 12 | uuid(F0488633-64CF-4B47-98E8-7CCF9F85E6F1), 13 | dual, 14 | helpstring("IExplorerBHO Interface"), 15 | pointer_default(unique) 16 | ] 17 | interface IExplorerBHO : IDispatch 18 | { 19 | }; 20 | 21 | [ 22 | uuid(56DB5067-F8E7-41A5-A09B-5CFEFE25B841), 23 | version(1.0), 24 | helpstring("FolderOptions 1.0 Type Library") 25 | ] 26 | library FOLDEROPTIONSLib 27 | { 28 | importlib("stdole32.tlb"); 29 | importlib("stdole2.tlb"); 30 | 31 | 32 | [ 33 | uuid(0AE87E97-08ED-4D43-ADA3-ADD3166FC4D2), 34 | helpstring("ExplorerBHO Class") 35 | ] 36 | coclass ExplorerBHO 37 | { 38 | [default] interface IExplorerBHO; 39 | }; 40 | }; 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Folder Options X 2 | Windows Explorer browser helper add-on which enables hidden folder options. 3 | ![alt text](https://github.com/T800G/FolderOptionsX/blob/master/foptmgr.png "Folder Options X Manager")
4 | You have to close all opened windows before changes are applied.
5 | ## Minimum system requirements 6 | * Windows 7 (32 and 64-bit) 7 | 8 | ## Important 9 | Third party browser extensions option must be enabled to use this add-on (Internet Properties->Advanced).
10 | ![alt text](https://github.com/T800G/FolderOptionsX/blob/master/IEoptions.png "Internet options")
11 | If you reset Internet Explorer settings, you might have to re-enable third party browser extensions option .
12 | If you are using Internet Explorer 8, Folder Options X extension must be enabled in Add-ons manager.
13 | ![alt text](https://github.com/T800G/FolderOptionsX/blob/master/IEaddons.png "Internet Explorer Add-ons manager")
14 |
15 | ## Credits 16 | Icons by FatCow Web Hosting 17 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/Resource.h: -------------------------------------------------------------------------------- 1 | #ifndef IDC_STATIC 2 | #define IDC_STATIC (-1) 3 | #endif 4 | 5 | #define IDI_FOLDEROPTIONS 107 6 | #define IDD_MAINDLG 109 7 | #define IDB_FULLROW 111 8 | #define IDB_HEADERS 112 9 | #define IDB_REORDER 113 10 | #define IDB_FOCUS 115 11 | #define IDC_STATICBKG 1000 12 | #define IDC_CUSTOM1 1001 13 | #define IDC_COPYRIGHT 1002 14 | #define IDC_CUSTOM2 1003 15 | #define IDC_APPLY 1004 16 | #define IDC_CUSTOM3 1005 17 | #define IDC_NOFULLROWSELECT 1006 18 | #define IDC_CUSTOMORDERING 1007 19 | #define IDC_HEADERS 1008 20 | #define IDC_GROUP1 1009 21 | #define IDC_CUSTOM4 1010 22 | #define IDC_FOCUS 1012 23 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/FolderOptions.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ExplorerBHO.h" 3 | #include "resource.h" 4 | #include 5 | #include "FolderOptions.h" 6 | 7 | #include "FolderOptions_i.c" 8 | 9 | CComModule _Module; 10 | 11 | BEGIN_OBJECT_MAP(ObjectMap) 12 | OBJECT_ENTRY(CLSID_ExplorerBHO, CExplorerBHO) 13 | END_OBJECT_MAP() 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // DLL Entry Point 17 | 18 | extern "C" 19 | BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) 20 | { 21 | if (dwReason == DLL_PROCESS_ATTACH) 22 | { 23 | _Module.Init(ObjectMap, hInstance, &LIBID_FOLDEROPTIONSLib); 24 | } 25 | else 26 | if (dwReason == DLL_PROCESS_DETACH) 27 | _Module.Term(); 28 | return TRUE; 29 | } 30 | 31 | STDAPI DllCanUnloadNow(void){return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;} 32 | 33 | STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv){return _Module.GetClassObject(rclsid, riid, ppv);} 34 | 35 | STDAPI DllRegisterServer(void){return _Module.RegisterServer(TRUE);} 36 | 37 | STDAPI DllUnregisterServer(void){return _Module.UnregisterServer(TRUE);} 38 | 39 | 40 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/settings.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTRY_78FC5EFB_5023_42B3_8152_168077A8FC1D_ 2 | #define _REGISTRY_78FC5EFB_5023_42B3_8152_168077A8FC1D_ 3 | #include 4 | #pragma comment(lib,"Shlwapi.lib") 5 | 6 | //HKCU (per-user settings) 7 | #define FO_APP_KEY _T("Software\\T800 Productions\\{0AE87E97-08ED-4D43-ADA3-ADD3166FC4D2}") 8 | 9 | #define FO_HEADERS 0x00000001 10 | #define FO_NOFULLROWSELECT 0x00000002 11 | #define FO_CUSTOMORDERING 0x00000004 12 | #define FO_LVFOCUS 0x00000008 13 | #define FO_DEFAULTSETTINGS (FO_HEADERS|FO_NOFULLROWSELECT|FO_CUSTOMORDERING|FO_LVFOCUS) 14 | 15 | 16 | 17 | inline void LoadFolderSettings(DWORD* pdwSettings) 18 | { 19 | *pdwSettings=FO_DEFAULTSETTINGS; 20 | DWORD dwValue; 21 | DWORD dwType; 22 | DWORD pcbData=sizeof(DWORD); 23 | LSTATUS ls=SHGetValue(HKEY_CURRENT_USER, FO_APP_KEY, _T("FolderFlags"), &dwType, (LPBYTE)(&dwValue), &pcbData); 24 | if (ls==ERROR_SUCCESS && dwType==REG_DWORD) 25 | *pdwSettings=dwValue; 26 | } 27 | 28 | inline BOOL ApplyFolderSettings(DWORD dwSettings) 29 | { 30 | return (ERROR_SUCCESS==SHSetValue(HKEY_CURRENT_USER, FO_APP_KEY, _T("FolderFlags"), REG_DWORD, (LPCVOID)(&dwSettings), sizeof(DWORD))); 31 | } 32 | 33 | #endif//_REGISTRY_78FC5EFB_5023_42B3_8152_168077A8FC1D_ 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/stdafx.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDAFX_DB9E2851_C023_4827_BD38_D643527E3629_ 2 | #define _STDAFX_DB9E2851_C023_4827_BD38_D643527E3629_ 3 | #pragma once 4 | 5 | #define STRICT 6 | #ifndef _WIN32_WINNT 7 | #define _WIN32_WINNT _WIN32_WINNT_WIN7 8 | #endif 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | #include 14 | #include 15 | 16 | // C RunTime Header Files 17 | #ifndef _ATL_MIN_CRT 18 | #include 19 | #include 20 | #include 21 | #endif 22 | 23 | //only appropriate version will run 24 | #if defined _M_IX86 25 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 26 | #elif defined _M_IA64 27 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") 28 | #elif defined _M_X64 29 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 30 | #else 31 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 32 | #endif 33 | 34 | #endif//_STDAFX_DB9E2851_C023_4827_BD38_D643527E3629_ 35 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsX.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual C++ Express 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FolderOptions", "FolderOptions\FolderOptions.vcproj", "{E6B37EBB-6975-4C4A-8BD7-2AC620AC45A1}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FolderOptionsMgr", "FolderOptionsMgr\FolderOptionsMgr.vcproj", "{1483FC4F-32D4-4351-BCE7-96B196EB7E96}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {E6B37EBB-6975-4C4A-8BD7-2AC620AC45A1}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {E6B37EBB-6975-4C4A-8BD7-2AC620AC45A1}.Debug|Win32.Build.0 = Debug|Win32 18 | {E6B37EBB-6975-4C4A-8BD7-2AC620AC45A1}.Debug|x64.ActiveCfg = Debug|x64 19 | {E6B37EBB-6975-4C4A-8BD7-2AC620AC45A1}.Debug|x64.Build.0 = Debug|x64 20 | {E6B37EBB-6975-4C4A-8BD7-2AC620AC45A1}.Release|Win32.ActiveCfg = Release|Win32 21 | {E6B37EBB-6975-4C4A-8BD7-2AC620AC45A1}.Release|Win32.Build.0 = Release|Win32 22 | {E6B37EBB-6975-4C4A-8BD7-2AC620AC45A1}.Release|x64.ActiveCfg = Release|x64 23 | {E6B37EBB-6975-4C4A-8BD7-2AC620AC45A1}.Release|x64.Build.0 = Release|x64 24 | {1483FC4F-32D4-4351-BCE7-96B196EB7E96}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {1483FC4F-32D4-4351-BCE7-96B196EB7E96}.Debug|Win32.Build.0 = Debug|Win32 26 | {1483FC4F-32D4-4351-BCE7-96B196EB7E96}.Debug|x64.ActiveCfg = Debug|x64 27 | {1483FC4F-32D4-4351-BCE7-96B196EB7E96}.Debug|x64.Build.0 = Debug|x64 28 | {1483FC4F-32D4-4351-BCE7-96B196EB7E96}.Release|Win32.ActiveCfg = Release|Win32 29 | {1483FC4F-32D4-4351-BCE7-96B196EB7E96}.Release|Win32.Build.0 = Release|Win32 30 | {1483FC4F-32D4-4351-BCE7-96B196EB7E96}.Release|x64.ActiveCfg = Release|x64 31 | {1483FC4F-32D4-4351-BCE7-96B196EB7E96}.Release|x64.Build.0 = Release|x64 32 | EndGlobalSection 33 | GlobalSection(SolutionProperties) = preSolution 34 | HideSolutionNode = FALSE 35 | EndGlobalSection 36 | EndGlobal 37 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/ExplorerBHO.h: -------------------------------------------------------------------------------- 1 | #ifndef _EXPLORERBHO_99B69ACD_5ADF_4FD0_863C_158A9D3E736E_ 2 | #define _EXPLORERBHO_99B69ACD_5ADF_4FD0_863C_158A9D3E736E_ 3 | 4 | #include "resource.h" // main symbols 5 | #include "FolderOptions.h" 6 | #include "settings.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #pragma comment(lib,"atlthunk.lib") //resolves error LNK2019 'missing CComStdCallThunkHelper()' for x64 build 15 | 16 | 17 | ///////////////////////////////////////////////////////////////////////////// 18 | // CExplorerBHO 19 | 20 | class ATL_NO_VTABLE CExplorerBHO : 21 | public CComObjectRootEx, 22 | public CComCoClass, 23 | public IObjectWithSiteImpl, 24 | public IDispatchImpl 25 | { 26 | public: 27 | CExplorerBHO(): m_dwEventCookie(0xFEFEFEFE), m_bNavComplete2(FALSE), m_dwSettings(FO_DEFAULTSETTINGS) {} 28 | 29 | BEGIN_COM_MAP(CExplorerBHO) 30 | COM_INTERFACE_ENTRY(IDispatch) 31 | COM_INTERFACE_ENTRY(IObjectWithSite) 32 | END_COM_MAP() 33 | 34 | DECLARE_NOT_AGGREGATABLE(CExplorerBHO) 35 | DECLARE_REGISTRY_RESOURCEID(IDR_ExplorerBHO) 36 | DECLARE_PROTECT_FINAL_CONSTRUCT() 37 | 38 | HRESULT FinalConstruct(); 39 | void FinalRelease(); 40 | 41 | //IObjectWithSite override 42 | STDMETHOD(SetSite)(IUnknown *pUnkSite); 43 | 44 | //IDispatch override 45 | STDMETHOD(Invoke)(DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*, EXCEPINFO*, UINT*); 46 | 47 | private: 48 | CComPtr m_pWebBrowser2; 49 | CComPtr m_pShellBrowser; 50 | DWORD m_dwSettings; 51 | BOOL m_bNavComplete2; 52 | HWND FindShellLV(IShellBrowser* pshb, LPCTSTR lpszClass); 53 | 54 | //from _IDispEvent 55 | DWORD m_dwEventCookie; 56 | HRESULT DispEventAdvise(IUnknown* pUnk, const IID* piid) 57 | { 58 | ATLENSURE(m_dwEventCookie == 0xFEFEFEFE); 59 | return AtlAdvise(pUnk, reinterpret_cast(this), *piid, &m_dwEventCookie); 60 | } 61 | HRESULT DispEventUnadvise(IUnknown* pUnk, const IID* piid) 62 | { 63 | HRESULT hr = AtlUnadvise(pUnk, *piid, m_dwEventCookie); 64 | m_dwEventCookie = 0xFEFEFEFE; 65 | return hr; 66 | } 67 | 68 | }; 69 | 70 | #endif//_EXPLORERBHO_99B69ACD_5ADF_4FD0_863C_158A9D3E736E_ 71 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef _HELPERS_EA32A1FB_41AA_40F2_AFD1_523A383C2C5F_ 2 | #define _HELPERS_EA32A1FB_41AA_40F2_AFD1_523A383C2C5F_ 3 | 4 | #ifdef _DEBUG 5 | #define DBGTRACE(x) OutputDebugStringA(x) 6 | #else 7 | #define DBGTRACE(x) 8 | #endif 9 | 10 | #include 11 | 12 | inline BOOL CenterWindow(HWND hWnd, HWND hWndCenter = HWND_DESKTOP) throw() 13 | { 14 | _ASSERTE(::IsWindow(hWnd)); 15 | 16 | // determine owner window to center against 17 | DWORD dwStyle = (DWORD)::GetWindowLong(hWnd, GWL_STYLE); 18 | if(hWndCenter == NULL) 19 | { 20 | if(dwStyle & WS_CHILD) 21 | hWndCenter = ::GetParent(hWnd); 22 | else 23 | hWndCenter = ::GetWindow(hWnd, GW_OWNER); 24 | } 25 | 26 | // get coordinates of the window relative to its parent 27 | RECT rcDlg; 28 | ::GetWindowRect(hWnd, &rcDlg); 29 | RECT rcArea; 30 | RECT rcCenter; 31 | HWND hWndParent; 32 | if(!(dwStyle & WS_CHILD)) 33 | { 34 | // don't center against invisible or minimized windows 35 | if(hWndCenter != NULL) 36 | { 37 | DWORD dwStyleCenter = ::GetWindowLong(hWndCenter, GWL_STYLE); 38 | if(!(dwStyleCenter & WS_VISIBLE) || (dwStyleCenter & WS_MINIMIZE)) 39 | hWndCenter = NULL; 40 | } 41 | 42 | // center within screen coordinates 43 | ::SystemParametersInfo(SPI_GETWORKAREA, NULL, &rcArea, NULL); 44 | if(hWndCenter == NULL) 45 | rcCenter = rcArea; 46 | else 47 | ::GetWindowRect(hWndCenter, &rcCenter); 48 | } 49 | else 50 | { 51 | // center within parent client coordinates 52 | hWndParent = ::GetParent(hWnd); 53 | _ASSERTE(::IsWindow(hWndParent)); 54 | 55 | ::GetClientRect(hWndParent, &rcArea); 56 | _ASSERTE(::IsWindow(hWndCenter)); 57 | ::GetClientRect(hWndCenter, &rcCenter); 58 | ::MapWindowPoints(hWndCenter, hWndParent, (POINT*)&rcCenter, 2); 59 | } 60 | 61 | int DlgWidth = rcDlg.right - rcDlg.left; 62 | int DlgHeight = rcDlg.bottom - rcDlg.top; 63 | 64 | // find dialog's upper left based on rcCenter 65 | int xLeft = (rcCenter.left + rcCenter.right) / 2 - DlgWidth / 2; 66 | int yTop = (rcCenter.top + rcCenter.bottom) / 2 - DlgHeight / 2; 67 | 68 | // if the dialog is outside the screen, move it inside 69 | if(xLeft < rcArea.left) 70 | xLeft = rcArea.left; 71 | else if(xLeft + DlgWidth > rcArea.right) 72 | xLeft = rcArea.right - DlgWidth; 73 | 74 | if(yTop < rcArea.top) 75 | yTop = rcArea.top; 76 | else if(yTop + DlgHeight > rcArea.bottom) 77 | yTop = rcArea.bottom - DlgHeight; 78 | 79 | // map screen coordinates to child coordinates 80 | return ::SetWindowPos(hWnd, NULL, xLeft, yTop, -1, -1, 81 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 82 | } 83 | 84 | #endif//_HELPERS_EA32A1FB_41AA_40F2_AFD1_523A383C2C5F_ 85 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef _HELPERS_7F097B6B_1667_474A_AD3E_B3005E27F7A7_ 2 | #define _HELPERS_7F097B6B_1667_474A_AD3E_B3005E27F7A7_ 3 | 4 | 5 | static void __tracemsg(LPCSTR msg) 6 | { 7 | ATLTRACE(msg);ATLTRACE("\n"); 8 | MessageBoxA(NULL,msg,NULL, MB_OK | MB_SYSTEMMODAL); 9 | } 10 | 11 | static void __tracefolderflags(IFolderView2* pfv2) 12 | { 13 | DWORD ff; 14 | if FAILED(pfv2->GetCurrentFolderFlags(&ff)) return; 15 | ATLTRACE("FWF_NONE=%d\n",((ff & FWF_NONE) ? 1 : 0)); 16 | ATLTRACE("FWF_AUTOARRANGE=%d\n",((ff & FWF_AUTOARRANGE) ? 1 : 0)); 17 | ATLTRACE("FWF_ABBREVIATEDNAMES=%d\n",((ff & FWF_ABBREVIATEDNAMES) ? 1 : 0)); 18 | ATLTRACE("FWF_SNAPTOGRID=%d\n",((ff & FWF_SNAPTOGRID) ? 1 : 0)); 19 | ATLTRACE("FWF_OWNERDATA=%d\n",((ff & FWF_OWNERDATA) ? 1 : 0)); 20 | ATLTRACE("FWF_BESTFITWINDOW=%d\n",((ff & FWF_BESTFITWINDOW) ? 1 : 0)); 21 | ATLTRACE("FWF_DESKTOP=%d\n",((ff & FWF_DESKTOP) ? 1 : 0)); 22 | ATLTRACE("FWF_SINGLESEL=%d\n",((ff & FWF_SINGLESEL) ? 1 : 0)); 23 | ATLTRACE("FWF_NOSUBFOLDERS=%d\n",((ff & FWF_NOSUBFOLDERS) ? 1 : 0)); 24 | ATLTRACE("FWF_TRANSPARENT=%d\n",((ff & FWF_TRANSPARENT) ? 1 : 0)); 25 | ATLTRACE("FWF_NOCLIENTEDGE=%d\n",((ff & FWF_NOCLIENTEDGE) ? 1 : 0)); 26 | ATLTRACE("FWF_NOSCROLL=%d\n",((ff & FWF_NOSCROLL) ? 1 : 0)); 27 | ATLTRACE("FWF_ALIGNLEFT=%d\n",((ff & FWF_ALIGNLEFT) ? 1 : 0)); 28 | ATLTRACE("FWF_NOICONS=%d\n",((ff & FWF_NOICONS) ? 1 : 0)); 29 | ATLTRACE("FWF_SHOWSELALWAYS=%d\n",((ff & FWF_SHOWSELALWAYS) ? 1 : 0)); 30 | ATLTRACE("FWF_NOVISIBLE=%d\n",((ff & FWF_NOVISIBLE) ? 1 : 0)); 31 | ATLTRACE("FWF_SINGLECLICKACTIVATE=%d\n",((ff & FWF_SINGLECLICKACTIVATE) ? 1 : 0)); 32 | ATLTRACE("FWF_NOWEBVIEW=%d\n",((ff & FWF_NOWEBVIEW) ? 1 : 0)); 33 | ATLTRACE("FWF_HIDEFILENAMES=%d\n",((ff & FWF_HIDEFILENAMES) ? 1 : 0)); 34 | ATLTRACE("FWF_CHECKSELECT=%d\n",((ff & FWF_CHECKSELECT) ? 1 : 0)); 35 | ATLTRACE("FWF_NOENUMREFRES =%d\n",((ff & FWF_NOENUMREFRESH) ? 1 : 0)); 36 | ATLTRACE("FWF_NOGROUPING=%d\n",((ff & FWF_NOGROUPING) ? 1 : 0)); 37 | ATLTRACE("FWF_FULLROWSELECT=%d\n",((ff & FWF_FULLROWSELECT) ? 1 : 0)); 38 | ATLTRACE("FWF_NOFILTERS=%d\n",((ff & FWF_NOFILTERS) ? 1 : 0)); 39 | ATLTRACE("FWF_NOCOLUMNHEADER=%d\n",((ff & FWF_NOCOLUMNHEADER) ? 1 : 0)); 40 | ATLTRACE("FWF_NOHEADERINALLVIEWS=%d\n",((ff & FWF_NOHEADERINALLVIEWS) ? 1 : 0)); 41 | ATLTRACE("FWF_EXTENDEDTILES=%d\n",((ff & FWF_EXTENDEDTILES) ? 1 : 0)); 42 | ATLTRACE("FWF_TRICHECKSELECT=%d\n",((ff & FWF_TRICHECKSELECT) ? 1 : 0)); 43 | ATLTRACE("FWF_AUTOCHECKSELECT=%d\n",((ff & FWF_AUTOCHECKSELECT) ? 1 : 0)); 44 | ATLTRACE("FWF_NOBROWSERVIEWSTATE=%d\n",((ff & FWF_NOBROWSERVIEWSTATE) ? 1 : 0)); 45 | ATLTRACE("FWF_SUBSETGROUPS=%d\n",((ff & FWF_SUBSETGROUPS) ? 1 : 0)); 46 | ATLTRACE("FWF_USESEARCHFOLDER=%d\n",((ff & FWF_USESEARCHFOLDER) ? 1 : 0)); 47 | ATLTRACE("FWF_ALLOWRTLREADING=%d\n",((ff & FWF_ALLOWRTLREADING) ? 1 : 0)); 48 | } 49 | 50 | static void __tracefolderflags2(IFolderView2* pfv2) 51 | { 52 | DWORD ff; 53 | if FAILED(pfv2->GetCurrentFolderFlags(&ff)) return; 54 | if (ff & FWF_NONE) ATLTRACE("FWF_NONE"); 55 | if (ff & FWF_AUTOARRANGE) ATLTRACE(" | FWF_AUTOARRANGE"); 56 | if (ff & FWF_ABBREVIATEDNAMES) ATLTRACE(" | FWF_ABBREVIATEDNAMES"); 57 | if (ff & FWF_SNAPTOGRID) ATLTRACE(" | FWF_SNAPTOGRID"); 58 | if (ff & FWF_OWNERDATA) ATLTRACE(" | FWF_OWNERDATA"); 59 | if (ff & FWF_BESTFITWINDOW) ATLTRACE(" | FWF_BESTFITWINDOW"); 60 | if (ff & FWF_DESKTOP) ATLTRACE(" | FWF_DESKTOP"); 61 | if (ff & FWF_SINGLESEL) ATLTRACE(" | FWF_SINGLESEL"); 62 | if (ff & FWF_NOSUBFOLDERS) ATLTRACE(" | FWF_NOSUBFOLDERS"); 63 | if (ff & FWF_TRANSPARENT) ATLTRACE(" | FWF_TRANSPARENT"); 64 | if (ff & FWF_NOCLIENTEDGE) ATLTRACE(" | FWF_NOCLIENTEDGE"); 65 | if (ff & FWF_NOSCROLL) ATLTRACE(" | FWF_NOSCROLL"); 66 | if (ff & FWF_ALIGNLEFT) ATLTRACE(" | FWF_ALIGNLEFT"); 67 | if (ff & FWF_NOICONS) ATLTRACE(" | FWF_NOICONS"); 68 | if (ff & FWF_SHOWSELALWAYS) ATLTRACE(" | FWF_SHOWSELALWAYS"); 69 | if (ff & FWF_NOVISIBLE) ATLTRACE(" | FWF_NOVISIBLE"); 70 | if (ff & FWF_SINGLECLICKACTIVATE) ATLTRACE(" | FWF_SINGLECLICKACTIVATE"); 71 | if (ff & FWF_NOWEBVIEW) ATLTRACE(" | FWF_NOWEBVIEW"); 72 | if (ff & FWF_HIDEFILENAMES) ATLTRACE(" | FWF_HIDEFILENAMES"); 73 | if (ff & FWF_CHECKSELECT) ATLTRACE(" | FWF_CHECKSELECT"); 74 | if (ff & FWF_NOENUMREFRESH) ATLTRACE(" | FWF_NOENUMREFRES "); 75 | if (ff & FWF_NOGROUPING) ATLTRACE(" | FWF_NOGROUPING"); 76 | if (ff & FWF_FULLROWSELECT) ATLTRACE(" | FWF_FULLROWSELECT"); 77 | if (ff & FWF_NOFILTERS) ATLTRACE(" | FWF_NOFILTERS"); 78 | if (ff & FWF_NOCOLUMNHEADER) ATLTRACE(" | FWF_NOCOLUMNHEADER"); 79 | if (ff & FWF_NOHEADERINALLVIEWS) ATLTRACE(" | FWF_NOHEADERINALLVIEWS"); 80 | if (ff & FWF_EXTENDEDTILES) ATLTRACE(" | FWF_EXTENDEDTILES"); 81 | if (ff & FWF_TRICHECKSELECT) ATLTRACE(" | FWF_TRICHECKSELECT"); 82 | if (ff & FWF_AUTOCHECKSELECT) ATLTRACE(" | FWF_AUTOCHECKSELECT"); 83 | if (ff & FWF_NOBROWSERVIEWSTATE) ATLTRACE(" | FWF_NOBROWSERVIEWSTATE"); 84 | if (ff & FWF_SUBSETGROUPS) ATLTRACE(" | FWF_SUBSETGROUPS"); 85 | if (ff & FWF_USESEARCHFOLDER) ATLTRACE(" | FWF_USESEARCHFOLDER"); 86 | if (ff & FWF_ALLOWRTLREADING) ATLTRACE(" | FWF_ALLOWRTLREADING"); 87 | ATLTRACE("\n"); 88 | } 89 | 90 | #endif//_HELPERS_7F097B6B_1667_474A_AD3E_B3005E27F7A7_ 91 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/FolderOptionsMgr.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include 3 | #pragma comment(lib,"Comctl32.lib") 4 | #include "resource.h" 5 | #include "helpers.h" 6 | #include "..\FolderOptions\settings.h" 7 | 8 | 9 | void OnApplySettings(HWND hDlg) 10 | { 11 | DWORD dwSettings=0; 12 | 13 | dwSettings|=(BST_CHECKED==Button_GetCheck(GetDlgItem(hDlg, IDC_NOFULLROWSELECT))) ? FO_NOFULLROWSELECT : 0; 14 | dwSettings|=(BST_CHECKED==Button_GetCheck(GetDlgItem(hDlg, IDC_HEADERS))) ? FO_HEADERS : 0; 15 | dwSettings|=(BST_CHECKED==Button_GetCheck(GetDlgItem(hDlg, IDC_CUSTOMORDERING))) ? FO_CUSTOMORDERING : 0; 16 | dwSettings|=(BST_CHECKED==Button_GetCheck(GetDlgItem(hDlg, IDC_FOCUS))) ? FO_LVFOCUS : 0; 17 | 18 | if (!ApplyFolderSettings(dwSettings)) MessageBeep(MB_ICONERROR); 19 | } 20 | 21 | //window proc for "framed white background" control 22 | WNDPROC pOldWndProc; 23 | LRESULT CALLBACK StaticBkgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 24 | { 25 | if (uMsg==WM_PAINT) 26 | { 27 | if (GetUpdateRect(hWnd, NULL, FALSE)) 28 | { 29 | PAINTSTRUCT pPaint; 30 | HDC hDc=BeginPaint(hWnd, &pPaint); 31 | if (hDc) 32 | { 33 | RECT rc; 34 | if (GetClientRect(hWnd, &rc)) 35 | { 36 | FillRect(hDc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH)); 37 | FrameRect(hDc, &rc, (HBRUSH)GetStockObject(GRAY_BRUSH)); 38 | } 39 | } 40 | EndPaint(hWnd, &pPaint); 41 | } 42 | return 0; 43 | } 44 | return CallWindowProc(pOldWndProc, hWnd, uMsg, wParam, lParam); 45 | } 46 | 47 | 48 | INT_PTR CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) 49 | { 50 | UNREFERENCED_PARAMETER(lParam); 51 | switch (message) 52 | { 53 | case WM_INITDIALOG: 54 | { 55 | DBGTRACE("WM_INITDIALOG\n"); 56 | 57 | //set dlg icon 58 | HICON hIcon = (HICON)::LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FOLDEROPTIONS), 59 | IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); 60 | if (hIcon) SendMessage(hDlg, WM_SETICON, TRUE, (LPARAM)hIcon); 61 | HICON hIconSmall = (HICON)::LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FOLDEROPTIONS), 62 | IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); 63 | if (hIconSmall) SendMessage(hDlg, WM_SETICON, FALSE, (LPARAM)hIconSmall); 64 | 65 | //set checkboxes 66 | DWORD dwsettings; 67 | LoadFolderSettings(&dwsettings); 68 | Button_SetCheck(GetDlgItem(hDlg, IDC_NOFULLROWSELECT), ((dwsettings & FO_NOFULLROWSELECT) ? BST_CHECKED : BST_UNCHECKED)); 69 | Button_SetCheck(GetDlgItem(hDlg, IDC_HEADERS), ((dwsettings & FO_HEADERS) ? BST_CHECKED : BST_UNCHECKED)); 70 | Button_SetCheck(GetDlgItem(hDlg, IDC_CUSTOMORDERING), ((dwsettings & FO_CUSTOMORDERING) ? BST_CHECKED : BST_UNCHECKED)); 71 | Button_SetCheck(GetDlgItem(hDlg, IDC_FOCUS), ((dwsettings & FO_LVFOCUS) ? BST_CHECKED : BST_UNCHECKED)); 72 | 73 | pOldWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, IDC_STATICBKG), GWLP_WNDPROC, (LONG_PTR)StaticBkgProc); 74 | 75 | CenterWindow(hDlg); 76 | } 77 | return (INT_PTR)TRUE; 78 | 79 | case WM_CTLCOLORSTATIC: 80 | switch (GetDlgCtrlID((HWND)lParam)) 81 | { 82 | //controls on white bkg 83 | case IDC_COPYRIGHT: 84 | SetTextColor((HDC)wParam,GetSysColor(COLOR_GRAYTEXT)); 85 | case IDC_STATICBKG: 86 | case IDC_GROUP1: 87 | case IDC_NOFULLROWSELECT: 88 | case IDC_HEADERS: 89 | case IDC_CUSTOMORDERING: 90 | case IDC_FOCUS: 91 | case IDC_CUSTOM1: 92 | case IDC_CUSTOM2: 93 | case IDC_CUSTOM3: 94 | case IDC_CUSTOM4: 95 | return (UINT_PTR)GetStockObject(WHITE_BRUSH); 96 | default:break; 97 | } 98 | break; 99 | 100 | case WM_COMMAND: 101 | switch LOWORD(wParam) 102 | { 103 | 104 | //CHECKBOX (not AUTOCHECKBOX) buttons need settings state manualy 105 | case IDC_HEADERS: 106 | case IDC_NOFULLROWSELECT: 107 | case IDC_CUSTOMORDERING: 108 | if (HIWORD(wParam)==BN_CLICKED) 109 | { 110 | BOOL bstate=!((BOOL)Button_GetCheck(GetDlgItem(hDlg, LOWORD(wParam)))); 111 | Button_SetCheck(GetDlgItem(hDlg, LOWORD(wParam)), bstate); 112 | 113 | //fullrowselect and headers depend on custom ordering 114 | if ((LOWORD(wParam)!=IDC_CUSTOMORDERING) && (bstate==BST_CHECKED)) 115 | Button_SetCheck(GetDlgItem(hDlg, IDC_CUSTOMORDERING), bstate); 116 | if ((LOWORD(wParam)==IDC_CUSTOMORDERING) && (bstate==BST_UNCHECKED)) 117 | { 118 | Button_SetCheck(GetDlgItem(hDlg, IDC_HEADERS), BST_UNCHECKED); 119 | Button_SetCheck(GetDlgItem(hDlg, IDC_NOFULLROWSELECT), BST_UNCHECKED); 120 | } 121 | } 122 | break; 123 | 124 | case IDC_APPLY: 125 | OnApplySettings(hDlg); 126 | break; 127 | case IDOK: 128 | OnApplySettings(hDlg);//apply and fallthrough 129 | case IDCANCEL: 130 | DBGTRACE("EndDialog\n"); 131 | EndDialog(hDlg, LOWORD(wParam)); 132 | return (INT_PTR)TRUE; 133 | default:break; 134 | } 135 | 136 | break; 137 | } 138 | return (INT_PTR)FALSE; 139 | } 140 | 141 | 142 | //main 143 | #ifdef _ATL_MIN_CRT //release build 144 | int WINAPI WinMainCRTStartup(void)//no crt 145 | #else 146 | int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR, int) 147 | #endif 148 | { 149 | //needed for XP, Win7/Vista loads common controls automatically? 150 | INITCOMMONCONTROLSEX icc; 151 | icc.dwSize=sizeof(INITCOMMONCONTROLSEX); 152 | icc.dwICC=ICC_STANDARD_CLASSES; 153 | InitCommonControlsEx(&icc); 154 | 155 | DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_MAINDLG), HWND_DESKTOP, DlgProc); 156 | #ifdef _ATL_MIN_CRT 157 | ExitProcess(0); 158 | #endif 159 | return 0; 160 | } 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/ExplorerBHO.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "FolderOptions.h" 3 | #include "ExplorerBHO.h" 4 | 5 | #include "helpers.h" 6 | 7 | HRESULT CExplorerBHO::FinalConstruct() 8 | { 9 | ATLTRACE("CExplorerBHO::FinalConstruct\n"); 10 | 11 | //don't load BHO in IE7/8 12 | TCHAR szExePath[MAX_PATH]; 13 | if (!GetModuleFileName(NULL, szExePath, MAX_PATH)) return HRESULT_FROM_WIN32(GetLastError()); 14 | if (StrCmpI(PathFindFileName(szExePath), _T("iexplore.exe"))==0) return E_ABORT; 15 | 16 | return S_OK; 17 | } 18 | void CExplorerBHO::FinalRelease() 19 | { 20 | ATLTRACE("CExplorerBHO::FinalRelease\n"); 21 | } 22 | 23 | 24 | HRESULT CExplorerBHO::SetSite(IUnknown *pUnkSite) 25 | { 26 | IObjectWithSiteImpl::SetSite(pUnkSite); 27 | 28 | if (pUnkSite) 29 | { 30 | LoadFolderSettings(&m_dwSettings);//settings apply on every new window/site 31 | 32 | CComPtr psp; 33 | if SUCCEEDED(pUnkSite->QueryInterface(IID_IServiceProvider,(void**)&psp)) 34 | { 35 | if (SUCCEEDED(psp->QueryService( SID_SWebBrowserApp, IID_IWebBrowser2, (void**)&m_pWebBrowser2)) && 36 | SUCCEEDED(psp->QueryService(SID_SShellBrowser, IID_IShellBrowser, (void**)&m_pShellBrowser))) 37 | { 38 | if (m_dwEventCookie==0xFEFEFEFE) 39 | DispEventAdvise( m_pWebBrowser2, &IID_IDispatch); 40 | 41 | //must set FVO_CUSTOMPOSITION here for fullrowselect/headers to work properly 42 | //see remarks in http://msdn.microsoft.com/en-us/library/bb775546%28v=vs.85%29.aspx 43 | if (m_dwSettings & (FO_HEADERS|FO_NOFULLROWSELECT|FO_CUSTOMORDERING)) 44 | { 45 | CComPtr pfvo; 46 | if SUCCEEDED(m_pShellBrowser->QueryInterface(IID_IFolderViewOptions, (void**)&pfvo))//query on IShellBrowser, not IShellView 47 | { 48 | //seems that FVO_CUSTOMPOSITION has same effect as FVO_CUSTOMORDERING 49 | pfvo->SetFolderViewOptions(FVO_CUSTOMPOSITION|FVO_CUSTOMORDERING,FVO_CUSTOMPOSITION|FVO_CUSTOMORDERING); 50 | } 51 | } 52 | } 53 | } 54 | } 55 | else 56 | { 57 | ATLTRACE("SetSite:: NULL\n"); 58 | if ((m_dwEventCookie != 0xFEFEFEFE) && m_pWebBrowser2) 59 | DispEventUnadvise(m_pWebBrowser2, &IID_IDispatch); 60 | 61 | m_pWebBrowser2.Release(); 62 | m_pShellBrowser.Release(); 63 | } 64 | return S_OK;//SetSite allways returns S_OK 65 | } 66 | 67 | 68 | HWND CExplorerBHO::FindShellLV(IShellBrowser* pshb, LPCTSTR lpszClass) 69 | { 70 | ATLASSERT(pshb); 71 | CComPtr pow; 72 | if (S_OK!=pshb->QueryInterface(IID_IOleWindow, (void**)&pow)) return NULL; 73 | HWND hw=NULL; 74 | if (S_OK!=pow->GetWindow(&hw)) return NULL; 75 | //IShellBrowser gives ShellTabWindowClass hwnd 76 | if (!hw) return NULL; 77 | 78 | hw=FindWindowEx(hw, NULL, _T("DUIViewWndClassName"), NULL); 79 | if (hw) 80 | { 81 | hw=FindWindowEx(hw, NULL, _T("DirectUIHWND"), NULL); 82 | if (hw) 83 | { 84 | //local class callback trick 85 | class CEnumChildWindows 86 | { 87 | public: 88 | CEnumChildWindows(LPCTSTR lpszClass): hwChild(NULL), m_lpszClass(lpszClass) {} 89 | 90 | void EnumChildWindows(HWND hWnd) { ::EnumChildWindows(hWnd, EnumChildWindowProcImpl, (LPARAM)this); } 91 | 92 | BOOL EnumChildWindowProc(HWND hwnd) 93 | { 94 | //find CtrlNotifySink >>> SHELLDLL_DefView >>> SysListView32 or DirectUIHWND 95 | HWND hw=::FindWindowEx(hwnd, NULL, _T("SHELLDLL_DefView"), NULL); 96 | if (hw) 97 | { 98 | hwChild=::FindWindowEx(hw, NULL, m_lpszClass, NULL); 99 | if (hwChild) return FALSE;//stop 100 | } 101 | return TRUE;//continue 102 | } 103 | 104 | protected: 105 | static BOOL CALLBACK EnumChildWindowProcImpl(HWND hwnd, LPARAM lParam) 106 | { 107 | return ((CEnumChildWindows*)lParam)->EnumChildWindowProc(hwnd); 108 | } 109 | 110 | public: 111 | HWND hwChild; 112 | private: 113 | LPCTSTR m_lpszClass; 114 | 115 | } ecw(lpszClass); 116 | 117 | ecw.EnumChildWindows(hw); 118 | 119 | if (ecw.hwChild) return ecw.hwChild; 120 | } 121 | } 122 | return NULL; 123 | } 124 | 125 | 126 | HRESULT CExplorerBHO::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, 127 | DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) 128 | { 129 | HRESULT hr=IDispatchImpl::Invoke(dispidMember, 131 | riid, lcid,wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); 132 | 133 | if (dispidMember==DISPID_ONQUIT) 134 | if((m_dwEventCookie!=0xFEFEFEFE) && m_pWebBrowser2) 135 | return DispEventUnadvise(m_pWebBrowser2, &IID_IDispatch); 136 | 137 | if (m_pShellBrowser==NULL) return hr; 138 | 139 | 140 | HWND hwLV=NULL; 141 | if (dispidMember==DISPID_DOCUMENTCOMPLETE) 142 | hwLV=FindShellLV(m_pShellBrowser, 143 | (m_dwSettings & (FO_HEADERS|FO_NOFULLROWSELECT|FO_CUSTOMORDERING)) ? _T("SysListView32") : _T("DirectUIHWND")); 144 | ATLTRACE("CExplorerBHO:: hwLV=%x", hwLV); 145 | 146 | //set flags in all events to get correct vertical scrollbar 147 | CComPtr psv; 148 | if SUCCEEDED(m_pShellBrowser->QueryActiveShellView(&psv)) 149 | { 150 | CComPtr pfv2; 151 | if SUCCEEDED(psv->QueryInterface(IID_IFolderView2, (void**)&pfv2)) 152 | { 153 | if (m_dwSettings & FO_NOFULLROWSELECT) pfv2->SetCurrentFolderFlags(FWF_FULLROWSELECT,0); 154 | 155 | if (m_dwSettings & FO_HEADERS) 156 | { 157 | if (S_OK==pfv2->SetCurrentFolderFlags(FWF_NOCOLUMNHEADER|FWF_NOHEADERINALLVIEWS,0))//both flags for headers 158 | { 159 | //fix scrollbar offset 160 | if (dispidMember==DISPID_NAVIGATECOMPLETE2) m_bNavComplete2=TRUE;//chain of events 161 | if (dispidMember==DISPID_DOCUMENTCOMPLETE && m_bNavComplete2) //navigation could be canceled 162 | { 163 | m_bNavComplete2=FALSE; 164 | 165 | if (hwLV) 166 | { 167 | HWND hwHDR=::FindWindowEx(hwLV, NULL, _T("SysHeader32"), NULL); 168 | if (hwHDR) 169 | { 170 | RECT rh; 171 | if (::GetWindowRect(hwHDR, &rh)) 172 | ListView_Scroll(hwLV, 0, (rh.top-rh.bottom)); 173 | } 174 | } 175 | } 176 | } 177 | } 178 | } 179 | } 180 | 181 | 182 | if ((m_dwSettings & FO_LVFOCUS) && (dispidMember==DISPID_DOCUMENTCOMPLETE)) 183 | { 184 | if (hwLV) 185 | { 186 | if ((GetFocus()!=hwLV) && !(GetAsyncKeyState(VK_SHIFT)<0)) 187 | SetFocus(hwLV); 188 | } 189 | } 190 | 191 | return hr; 192 | } 193 | 194 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptionsMgr/FolderOptionsMgr.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 18 | 19 | 20 | 21 | 22 | 29 | 32 | 35 | 38 | 41 | 44 | 55 | 58 | 61 | 64 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 93 | 100 | 103 | 106 | 109 | 112 | 116 | 127 | 130 | 133 | 136 | 143 | 146 | 149 | 152 | 155 | 158 | 161 | 164 | 165 | 173 | 176 | 179 | 182 | 185 | 188 | 199 | 202 | 205 | 208 | 218 | 221 | 224 | 227 | 230 | 233 | 236 | 239 | 240 | 248 | 251 | 254 | 257 | 260 | 264 | 275 | 278 | 282 | 285 | 295 | 298 | 301 | 304 | 307 | 310 | 313 | 316 | 317 | 318 | 319 | 320 | 321 | 326 | 329 | 330 | 333 | 336 | 340 | 341 | 344 | 348 | 349 | 352 | 356 | 357 | 360 | 364 | 365 | 366 | 367 | 372 | 375 | 376 | 379 | 380 | 381 | 386 | 389 | 390 | 393 | 394 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | -------------------------------------------------------------------------------- /The Code Project Open License (CPOL) 1.02.md: -------------------------------------------------------------------------------- 1 |

The Code Project Open License (CPOL) 1.02

2 |
3 | 4 |
5 |
6 | 7 |

Preamble

8 |

9 | This License governs Your use of the Work. This License is intended to allow developers 10 | to use the Source Code and Executable Files provided as part of the Work in any 11 | application in any form. 12 |

13 |

14 | The main points subject to the terms of the License are:

15 |
    16 |
  • Source Code and Executable Files can be used in commercial applications;
  • 17 |
  • Source Code and Executable Files can be redistributed; and
  • 18 |
  • Source Code can be modified to create derivative works.
  • 19 |
  • No claim of suitability, guarantee, or any warranty whatsoever is provided. The software is 20 | provided "as-is".
  • 21 |
  • The Article accompanying the Work may not be distributed or republished without the 22 | Author's consent
  • 23 |
24 | 25 |

26 | This License is entered between You, the individual or other entity reading or otherwise 27 | making use of the Work licensed pursuant to this License and the individual or other 28 | entity which offers the Work under the terms of this License ("Author").

29 | 30 |

License

31 |

32 | THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CODE PROJECT OPEN 33 | LICENSE ("LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE 34 | LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT 35 | LAW IS PROHIBITED.

36 |

37 | BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HEREIN, YOU ACCEPT AND AGREE TO BE 38 | BOUND BY THE TERMS OF THIS LICENSE. THE AUTHOR GRANTS YOU THE RIGHTS CONTAINED HEREIN 39 | IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. IF YOU DO NOT 40 | AGREE TO ACCEPT AND BE BOUND BY THE TERMS OF THIS LICENSE, YOU CANNOT MAKE ANY 41 | USE OF THE WORK.

42 | 43 |
    44 |
  1. Definitions. 45 | 46 |
      47 |
    1. "Articles" means, collectively, all articles written by Author 48 | which describes how the Source Code and Executable Files for the Work may be used 49 | by a user.
    2. 50 |
    3. "Author" means the individual or entity that offers the Work under the terms 51 | of this License.
    4. 52 |
    5. "Derivative Work" means a work based upon the Work or upon the 53 | Work and other pre-existing works.
    6. 54 |
    7. "Executable Files" refer to the executables, binary files, configuration 55 | and any required data files included in the Work.
    8. 56 |
    9. "Publisher" means the provider of the website, magazine, CD-ROM, DVD or other 57 | medium from or by which the Work is obtained by You.
    10. 58 |
    11. "Source Code" refers to the collection of source code and configuration files 59 | used to create the Executable Files.
    12. 60 |
    13. "Standard Version" refers to such a Work if it has not been modified, or 61 | has been modified in accordance with the consent of the Author, such consent being 62 | in the full discretion of the Author.
    14. 63 |
    15. "Work" refers to the collection of files distributed by the Publisher, including 64 | the Source Code, Executable Files, binaries, data files, documentation, whitepapers 65 | and the Articles.
    16. 66 |
    17. "You" is you, an individual or entity wishing to use the Work and exercise 67 | your rights under this License. 68 |
    18. 69 |
    70 |
  2. 71 | 72 |
  3. Fair Use/Fair Use Rights. Nothing in this License is intended to 73 | reduce, limit, or restrict any rights arising from fair use, fair dealing, first 74 | sale or other limitations on the exclusive rights of the copyright owner under copyright 75 | law or other applicable laws. 76 |
  4. 77 | 78 |
  5. License Grant. Subject to the terms and conditions of this License, 79 | the Author hereby grants You a worldwide, royalty-free, non-exclusive, perpetual 80 | (for the duration of the applicable copyright) license to exercise the rights in 81 | the Work as stated below: 82 | 83 |
      84 |
    1. You may use the standard version of the Source Code or Executable Files in Your 85 | own applications.
    2. 86 |
    3. You may apply bug fixes, portability fixes and other modifications obtained from 87 | the Public Domain or from the Author. A Work modified in such a way shall still 88 | be considered the standard version and will be subject to this License.
    4. 89 |
    5. You may otherwise modify Your copy of this Work (excluding the Articles) in any 90 | way to create a Derivative Work, provided that You insert a prominent notice in 91 | each changed file stating how, when and where You changed that file.
    6. 92 |
    7. You may distribute the standard version of the Executable Files and Source Code 93 | or Derivative Work in aggregate with other (possibly commercial) programs as part 94 | of a larger (possibly commercial) software distribution.
    8. 95 |
    9. The Articles discussing the Work published in any form by the author may not be 96 | distributed or republished without the Author's consent. The author retains 97 | copyright to any such Articles. You may use the Executable Files and Source Code 98 | pursuant to this License but you may not repost or republish or otherwise distribute 99 | or make available the Articles, without the prior written consent of the Author.
    10. 100 |
    101 | 102 | Any subroutines or modules supplied by You and linked into the Source Code or Executable 103 | Files of this Work shall not be considered part of this Work and will not be subject 104 | to the terms of this License. 105 |
  6. 106 | 107 |
  7. Patent License. Subject to the terms and conditions of this License, 108 | each Author hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 109 | irrevocable (except as stated in this section) patent license to make, have made, use, import, 110 | and otherwise transfer the Work.
  8. 111 | 112 |
  9. Restrictions. The license granted in Section 3 above is expressly 113 | made subject to and limited by the following restrictions: 114 | 115 |
      116 |
    1. You agree not to remove any of the original copyright, patent, trademark, and 117 | attribution notices and associated disclaimers that may appear in the Source Code 118 | or Executable Files.
    2. 119 |
    3. You agree not to advertise or in any way imply that this Work is a product of Your 120 | own.
    4. 121 |
    5. The name of the Author may not be used to endorse or promote products derived from 122 | the Work without the prior written consent of the Author.
    6. 123 |
    7. You agree not to sell, lease, or rent any part of the Work. This does not restrict 124 | you from including the Work or any part of the Work inside a larger software 125 | distribution that itself is being sold. The Work by itself, though, cannot be sold, 126 | leased or rented.
    8. 127 |
    9. You may distribute the Executable Files and Source Code only under the terms of 128 | this License, and You must include a copy of, or the Uniform Resource Identifier 129 | for, this License with every copy of the Executable Files or Source Code You distribute 130 | and ensure that anyone receiving such Executable Files and Source Code agrees that 131 | the terms of this License apply to such Executable Files and/or Source Code. You 132 | may not offer or impose any terms on the Work that alter or restrict the terms of 133 | this License or the recipients' exercise of the rights granted hereunder. You 134 | may not sublicense the Work. You must keep intact all notices that refer to this 135 | License and to the disclaimer of warranties. You may not distribute the Executable 136 | Files or Source Code with any technological measures that control access or use 137 | of the Work in a manner inconsistent with the terms of this License.
    10. 138 |
    11. You agree not to use the Work for illegal, immoral or improper purposes, or on pages 139 | containing illegal, immoral or improper material. The Work is subject to applicable 140 | export laws. You agree to comply with all such laws and regulations that may apply 141 | to the Work after Your receipt of the Work. 142 |
    12. 143 |
    144 |
  10. 145 | 146 |
  11. Representations, Warranties and Disclaimer. THIS WORK IS PROVIDED 147 | "AS IS", "WHERE IS" AND "AS AVAILABLE", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES 148 | OR CONDITIONS OR GUARANTEES. YOU, THE USER, ASSUME ALL RISK IN ITS USE, INCLUDING 149 | COPYRIGHT INFRINGEMENT, PATENT INFRINGEMENT, SUITABILITY, ETC. AUTHOR EXPRESSLY 150 | DISCLAIMS ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES OR CONDITIONS, INCLUDING 151 | WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF MERCHANTABILITY, MERCHANTABLE QUALITY 152 | OR FITNESS FOR A PARTICULAR PURPOSE, OR ANY WARRANTY OF TITLE OR NON-INFRINGEMENT, 153 | OR THAT THE WORK (OR ANY PORTION THEREOF) IS CORRECT, USEFUL, BUG-FREE OR FREE OF 154 | VIRUSES. YOU MUST PASS THIS DISCLAIMER ON WHENEVER YOU DISTRIBUTE THE WORK OR DERIVATIVE 155 | WORKS. 156 |
  12. 157 | 158 |
  13. Indemnity. You agree to defend, indemnify and hold harmless the Author and 159 | the Publisher from and against any claims, suits, losses, damages, liabilities, 160 | costs, and expenses (including reasonable legal or attorneys fees) resulting from 161 | or relating to any use of the Work by You. 162 |
  14. 163 | 164 |
  15. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE 165 | LAW, IN NO EVENT WILL THE AUTHOR OR THE PUBLISHER BE LIABLE TO YOU ON ANY LEGAL 166 | THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES 167 | ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK OR OTHERWISE, EVEN IF THE AUTHOR 168 | OR THE PUBLISHER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 169 |
  16. 170 | 171 |
  17. Termination. 172 | 173 |
      174 |
    1. This License and the rights granted hereunder will terminate automatically upon 175 | any breach by You of any term of this License. Individuals or entities who have 176 | received Derivative Works from You under this License, however, will not have their 177 | licenses terminated provided such individuals or entities remain in full compliance 178 | with those licenses. Sections 1, 2, 6, 7, 8, 9, 10 and 11 will survive any termination 179 | of this License.
    2. 180 | 181 |
    3. If You bring a copyright, trademark, patent or any other infringement claim against 182 | any contributor over infringements You claim are made by the Work, your License 183 | from such contributor to the Work ends automatically.
    4. 184 | 185 |
    5. Subject to the above terms and conditions, this License is perpetual (for the duration 186 | of the applicable copyright in the Work). Notwithstanding the above, the Author 187 | reserves the right to release the Work under different license terms or to stop 188 | distributing the Work at any time; provided, however that any such election will 189 | not serve to withdraw this License (or any other license that has been, or is required 190 | to be, granted under the terms of this License), and this License will continue 191 | in full force and effect unless terminated as stated above. 192 |
    6. 193 |
    194 |
  18. 195 | 196 |
  19. Publisher. The parties hereby confirm that the Publisher shall 197 | not, under any circumstances, be responsible for and shall not have any liability 198 | in respect of the subject matter of this License. The Publisher makes no warranty 199 | whatsoever in connection with the Work and shall not be liable to You or any party 200 | on any legal theory for any damages whatsoever, including without limitation any 201 | general, special, incidental or consequential damages arising in connection to this 202 | license. The Publisher reserves the right to cease making the Work available to 203 | You at any time without notice
  20. 204 | 205 |
  21. Miscellaneous 206 | 207 |
      208 |
    1. This License shall be governed by the laws of the location of the head office of 209 | the Author or if the Author is an individual, the laws of location of the principal 210 | place of residence of the Author.
    2. 211 |
    3. If any provision of this License is invalid or unenforceable under applicable law, 212 | it shall not affect the validity or enforceability of the remainder of the terms 213 | of this License, and without further action by the parties to this License, such 214 | provision shall be reformed to the minimum extent necessary to make such provision 215 | valid and enforceable.
    4. 216 |
    5. No term or provision of this License shall be deemed waived and no breach consented 217 | to unless such waiver or consent shall be in writing and signed by the party to 218 | be charged with such waiver or consent.
    6. 219 |
    7. This License constitutes the entire agreement between the parties with respect to 220 | the Work licensed herein. There are no understandings, agreements or representations 221 | with respect to the Work not specified herein. The Author shall not be bound by 222 | any additional provisions that may appear in any communication from You. This License 223 | may not be modified without the mutual written agreement of the Author and You. 224 |
    8. 225 |
    226 | 227 |
  22. 228 |
229 | 230 |
231 | -------------------------------------------------------------------------------- /FolderOptionsX/FolderOptions/FolderOptions.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 18 | 19 | 20 | 21 | 22 | 33 | 36 | 39 | 42 | 45 | 49 | 61 | 64 | 69 | 72 | 80 | 83 | 86 | 89 | 92 | 95 | 98 | 101 | 102 | 113 | 116 | 119 | 122 | 125 | 130 | 142 | 145 | 150 | 153 | 161 | 164 | 167 | 170 | 173 | 176 | 179 | 182 | 183 | 195 | 198 | 202 | 205 | 208 | 212 | 226 | 229 | 234 | 237 | 246 | 249 | 252 | 255 | 258 | 261 | 264 | 267 | 268 | 280 | 283 | 287 | 290 | 293 | 298 | 312 | 315 | 320 | 323 | 332 | 335 | 338 | 341 | 344 | 347 | 350 | 353 | 354 | 355 | 356 | 357 | 358 | 362 | 365 | 366 | 369 | 372 | 377 | 378 | 381 | 386 | 387 | 390 | 395 | 396 | 399 | 404 | 405 | 406 | 409 | 410 | 411 | 415 | 418 | 419 | 422 | 425 | 430 | 431 | 434 | 439 | 440 | 443 | 448 | 449 | 452 | 457 | 458 | 459 | 462 | 463 | 464 | 467 | 470 | 473 | 477 | 478 | 481 | 485 | 486 | 489 | 493 | 494 | 497 | 501 | 502 | 503 | 506 | 507 | 508 | 511 | 514 | 517 | 521 | 522 | 525 | 529 | 530 | 533 | 537 | 538 | 541 | 545 | 546 | 547 | 550 | 551 | 554 | 555 | 558 | 561 | 568 | 569 | 572 | 579 | 580 | 583 | 590 | 591 | 594 | 601 | 602 | 603 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | --------------------------------------------------------------------------------