Author: ssawant Date: Fri Jul 7 16:13:47 2017 New Revision: 75298
URL: http://svn.reactos.org/svn/reactos?rev=75298&view=rev Log: [QCKLNCH] -Apparently fixed some memory leaks. -Removed unnecessary methods. -Fixed a checkmark bug. :p -And thus finished any remaining issues of CR-122.
CR-122 (https://code.reactos.org/cru/CR-122#details)
PS: Please raise any other issues which you feel needs correction. I am waiting... ;D
Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.h branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/precomp.h branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/resource.h
Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/s... ============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp [iso-8859-1] Fri Jul 7 16:13:47 2017 @@ -33,7 +33,8 @@ }
CISFBand::~CISFBand() -{ +{ + CloseDW(0); }
// Toolbar @@ -62,8 +63,7 @@ // Enumerate objects CComPtr<IEnumIDList> pEndl; LPITEMIDLIST pidl; - STRRET stret; - ULONG count = 0; + STRRET stret; hr = m_pISF->EnumObjects(0, SHCONTF_FOLDERS, &pEndl); if (FAILED_UNEXPECTEDLY(hr)) { @@ -71,7 +71,7 @@ return hr; }
- for (int i=0; pEndl->Next(1, &pidl, NULL) != S_FALSE; i++, count++) + for (int i=0; pEndl->Next(1, &pidl, NULL) != S_FALSE; i++) { WCHAR sz[MAX_PATH]; int index = SHMapPIDLToSystemImageListIndex(m_pISF, pidl, NULL); @@ -84,8 +84,7 @@ StrRetToBuf(&stret, pidl, sz, _countof(sz));
TBBUTTON tb = { MAKELONG(index, 0), i, TBSTATE_ENABLED, buttonStyles,{ 0 }, (DWORD_PTR)pidl, (INT_PTR)sz }; - SendMessage(m_hWnd, TB_INSERTBUTTONW, i, (LPARAM)&tb); - //CoTaskMemFree(pidl); + SendMessage(m_hWnd, TB_INSERTBUTTONW, i, (LPARAM)&tb); }
// Resize the toolbar, and then show it. @@ -169,6 +168,18 @@ if (m_hWnd) { ShowWindow(SW_HIDE); + + CComPtr<IEnumIDList> pEndl; + LPITEMIDLIST pidl; + HRESULT hr = m_pISF->EnumObjects(0, SHCONTF_FOLDERS, &pEndl); + if (FAILED_UNEXPECTEDLY(hr)) + { + DestroyWindow(); + return hr; + } + while (pEndl->Next(1, &pidl, NULL) != S_FALSE) + CoTaskMemFree(pidl); + DestroyWindow(); m_hWnd = NULL; return S_OK; @@ -287,14 +298,7 @@ }
/*****************************************************************************/ -// *** IWinEventHandler *** - STDMETHODIMP CISFBand::ProcessMessage(IN HWND hWnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam, OUT LRESULT *plrResult) - { - TRACE("CISFBand: IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p)\n", hWnd, uMsg, wParam, lParam, plrResult); - - return E_NOTIMPL; - } - +// *** IWinEventHandler *** STDMETHODIMP CISFBand::ContainsWindow(IN HWND hWnd) { if (hWnd == m_hWnd || IsChild(hWnd)) @@ -351,7 +355,7 @@ { CMINVOKECOMMANDINFOEX info = { 0 }; info.cbSize = sizeof(info); - info.fMask = CMIC_MASK_UNICODE | CMIC_MASK_PTINVOKE; + info.fMask = CMIC_MASK_PTINVOKE; if (GetKeyState(VK_CONTROL) < 0) { info.fMask |= CMIC_MASK_CONTROL_DOWN; @@ -361,8 +365,7 @@ info.fMask |= CMIC_MASK_SHIFT_DOWN; } info.hwnd = m_hWnd; - info.lpVerb = MAKEINTRESOURCEA(id - 1); - info.lpVerbW = MAKEINTRESOURCEW(id - 0x7FFF); + info.lpVerb = MAKEINTRESOURCEA(id - 1); info.nShow = SW_SHOWNORMAL; info.ptInvoke = pt; picm->InvokeCommand((LPCMINVOKECOMMANDINFO)&info); @@ -536,25 +539,25 @@
STDMETHODIMP CISFBand::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) { - HMENU qMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_POPUPMENU)); + HMENU qMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_POPUPMENU)); + if(m_textFlag) + CheckMenuItem(qMenu, IDM_SHOW_TEXT, MF_CHECKED); + else + CheckMenuItem(qMenu, IDM_SHOW_TEXT, MF_UNCHECKED); + + if (m_iconFlag) + { + CheckMenuItem(qMenu, IDM_SMALL_ICONS, MF_CHECKED); + CheckMenuItem(qMenu, IDM_LARGE_ICONS, MF_UNCHECKED); + } + else + { + CheckMenuItem(qMenu, IDM_LARGE_ICONS, MF_CHECKED); + CheckMenuItem(qMenu, IDM_SMALL_ICONS, MF_UNCHECKED); + } + UINT idMax = Shell_MergeMenus(hmenu, GetSubMenu(qMenu, 0), indexMenu, idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS); - - if(m_textFlag) - CheckMenuItem(hmenu, IDM_SHOW_TEXT, MF_CHECKED); - else - CheckMenuItem(hmenu, IDM_SHOW_TEXT, MF_UNCHECKED); - - if (m_iconFlag) - { - CheckMenuItem(hmenu, IDM_SMALL_ICONS, MF_CHECKED); - CheckMenuItem(hmenu, IDM_LARGE_ICONS, MF_UNCHECKED); - } - else - { - CheckMenuItem(hmenu, IDM_LARGE_ICONS, MF_CHECKED); - CheckMenuItem(hmenu, IDM_SMALL_ICONS, MF_UNCHECKED); - } - + DestroyMenu(qMenu); return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(idMax - idCmdFirst +1)); }
Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/s... ============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h [iso-8859-1] Fri Jul 7 16:13:47 2017 @@ -102,15 +102,7 @@ IN BOOL fClearDirty );
-// IWinEventHandler - - virtual STDMETHODIMP ProcessMessage( - IN HWND hWnd, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam, - OUT LRESULT *plrResult - ); +// IWinEventHandler
virtual STDMETHODIMP ContainsWindow( IN HWND hWnd
Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/s... ============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp [iso-8859-1] Fri Jul 7 16:13:47 2017 @@ -253,13 +253,6 @@
/*****************************************************************************/ // IWinEventHandler - STDMETHODIMP CQuickLaunchBand::ProcessMessage(IN HWND hWnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam, OUT LRESULT *plrResult) - { - TRACE("CQuickLaunchBand: IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p)\n", hWnd, uMsg, wParam, lParam, plrResult); - - return E_NOTIMPL; - } - STDMETHODIMP CQuickLaunchBand::ContainsWindow(IN HWND hWnd) { return E_NOTIMPL;
Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/s... ============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.h [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.h [iso-8859-1] Fri Jul 7 16:13:47 2017 @@ -98,15 +98,7 @@ IN BOOL fClearDirty );
-// IWinEventHandler - - virtual STDMETHODIMP ProcessMessage( - IN HWND hWnd, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam, - OUT LRESULT *plrResult - ); +// IWinEventHandler
virtual STDMETHODIMP ContainsWindow( IN HWND hWnd
Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/precomp.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/s... ============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/precomp.h [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/precomp.h [iso-8859-1] Fri Jul 7 16:13:47 2017 @@ -37,8 +37,5 @@ #include <wine/unicode.h>
#include "resource.h" - -#undef DbgPrint - #include "CQuickLaunchBand.h" #include "CISFBand.h"
Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/resource.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/s... ============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/resource.h [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/resource.h [iso-8859-1] Fri Jul 7 16:13:47 2017 @@ -3,9 +3,9 @@ #define IDR_QCKLNCH 1001
#define IDM_POPUPMENU 2001 -#define IDM_LARGE_ICONS 101 -#define IDM_SMALL_ICONS 102 -#define IDM_SHOW_TEXT 103 -#define IDM_VIEW_MENU 104 +#define IDM_LARGE_ICONS 1 +#define IDM_SMALL_ICONS 2 +#define IDM_SHOW_TEXT 3 +#define IDM_VIEW_MENU 4
-#define IDS_BROWSEINFO_TITLE 201 +#define IDS_BROWSEINFO_TITLE 101