Author: ssawant Date: Thu Jun 8 15:18:21 2017 New Revision: 74961
URL: http://svn.reactos.org/svn/reactos?rev=74961&view=rev Log: [QCKLNCH] -Created a sample button to test toolbar area. -Added qcklnch.dll entry in syssetup.inf file for registration.
Modified: 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/qcklnch.cpp branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/rgs/qcklnch.rgs branches/GSoC_2017/shellext/reactos/media/inf/syssetup.inf
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] Thu Jun 8 15:18:21 2017 @@ -13,7 +13,7 @@ // {260CB95D-4544-44F6-A079-575BAA60B72F} static const GUID CLSID_QuickLaunchBand = { 0x260cb95d, 0x4544, 0x44f6, { 0xa0, 0x79, 0x57, 0x5b, 0xaa, 0x60, 0xb7, 0x2f } };
-//RegComCat function +//Componenet Category Registration HRESULT RegisterComCat() { ICatRegister *pcr; @@ -26,6 +26,18 @@ } return hr; } +HRESULT UnregisterComCat() +{ + ICatRegister *pcr; + HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr); + if (SUCCEEDED(hr)) + { + CATID catid = CATID_DeskBand; + hr = pcr->UnRegisterClassImplCategories(CLSID_QuickLaunchBand, 1, &catid); + pcr->Release(); + } + return hr; +}
//CQuickLaunchBand
@@ -42,7 +54,9 @@ //IObjectWithSite HRESULT STDMETHODCALLTYPE CQuickLaunchBand::SetSite(IUnknown *pUnkSite) { - /*HRESULT hRet; + MessageBox(0, L"CQuickLaunchBand::SetSite called!", L"Testing", MB_OK | MB_ICONINFORMATION); + + HRESULT hRet; HWND hwndSite;
TRACE("CQuickLaunchBand::SetSite(0x%p)\n", pUnkSite); @@ -53,19 +67,10 @@ TRACE("Querying site window failed: 0x%x\n", hRet); return hRet; } - - TRACE("CreateTaskSwitchWnd(Parent: 0x%p)\n", hwndSite); - - HWND hwndTaskSwitch = CreateTaskSwitchWnd(hwndSite, m_Tray); - if (!hwndTaskSwitch) - { - ERR("CreateTaskSwitchWnd failed"); - return E_FAIL; - } - - m_Site = pUnkSite; - m_hWnd = hwndTaskSwitch;*/ - + m_Site = pUnkSite; + + m_hWnd = CreateWindowEx(0, L"BUTTON", L"Quick Launch >>", WS_CHILD, CW_USEDEFAULT, CW_USEDEFAULT, 50, 50, hwndSite, 0, m_hInstance, 0); + return S_OK; }
@@ -73,14 +78,16 @@ IN REFIID riid, OUT VOID **ppvSite) { + //MessageBox(0, L"GetSite called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); TRACE("CQuickLaunchBand::GetSite(0x%p,0x%p)\n", riid, ppvSite);
- /* if (m_Site != NULL) + if (m_Site != NULL) { return m_Site->QueryInterface(riid, ppvSite); }
- *ppvSite = NULL;*/ + *ppvSite = NULL; + return E_FAIL; }
@@ -88,11 +95,14 @@ //IDeskBand HRESULT STDMETHODCALLTYPE CQuickLaunchBand::GetWindow(OUT HWND *phwnd) { - /*if (!m_hWnd) + //MessageBox(0, L"GetWindow called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); + + if (!m_hWnd) return E_FAIL; if (!phwnd) return E_INVALIDARG; - *phwnd = m_hWnd;*/ + *phwnd = m_hWnd; + return S_OK; }
@@ -100,20 +110,36 @@ IN BOOL fEnterMode) { /* FIXME: Implement */ + + //MessageBox(0, L"ContextSensitiveHelp called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE CQuickLaunchBand::ShowDW( IN BOOL bShow) { + //MessageBox(0, L"ShowDW called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); /* We don't do anything... */ + if (m_hWnd) + { + ShowWindow(m_hWnd, bShow ? SW_SHOW : SW_HIDE); + } + return S_OK; }
HRESULT STDMETHODCALLTYPE CQuickLaunchBand::CloseDW( IN DWORD dwReserved) { + //MessageBox(0, L"CloseDW called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); /* We don't do anything... */ + if (m_hWnd) + { + ShowWindow(m_hWnd, SW_HIDE); + DestroyWindow(m_hWnd); + m_hWnd = NULL; + } + return S_OK; }
@@ -123,6 +149,8 @@ BOOL fReserved) { /* No need to implement this method */ + + //MessageBox(0, L"ResizeBorderDW called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return E_NOTIMPL; }
@@ -131,7 +159,58 @@ IN DWORD dwViewMode, IN OUT DESKBANDINFO *pdbi) { - TRACE("CQuickLaunchBand::GetBandInfo(0x%x,0x%x,0x%p) hWnd=0x%p\n", dwBandID, dwViewMode, pdbi, m_hWnd); + //MessageBox(0, L"GetBandInfo called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); + TRACE("CTaskBand::GetBandInfo(0x%x,0x%x,0x%p) hWnd=0x%p\n", dwBandID, dwViewMode, pdbi, m_hWnd); + + if (m_hWnd != NULL) + { + /* The task band never has a title */ + pdbi->dwMask &= ~DBIM_TITLE; + + /* NOTE: We don't return DBIMF_UNDELETEABLE here, the band site will + handle us differently and add this flag for us. The reason for + this is future changes that might allow it to be deletable. + We want the band site to be in charge of this decision rather + the band itself! */ + /* FIXME: What about DBIMF_NOGRIPPER and DBIMF_ALWAYSGRIPPER */ + pdbi->dwModeFlags = DBIMF_VARIABLEHEIGHT; + + if (dwViewMode & DBIF_VIEWMODE_VERTICAL) + { + pdbi->ptIntegral.y = 1; + pdbi->ptMinSize.y = 1; + /* FIXME: Get the button metrics from the task bar object!!! */ + pdbi->ptMinSize.x = (3 * GetSystemMetrics(SM_CXEDGE) / 2) + /* FIXME: Might be wrong if only one column! */ + GetSystemMetrics(SM_CXSIZE) + (2 * GetSystemMetrics(SM_CXEDGE)); /* FIXME: Min button size, query!!! */ + } + else + { + /* When the band is horizontal its minimum height is the height of the start button */ + RECT rcButton; + GetWindowRect(m_hWndStartButton, &rcButton); + pdbi->ptMinSize.y = rcButton.bottom - rcButton.top; + pdbi->ptIntegral.y = pdbi->ptMinSize.y + (3 * GetSystemMetrics(SM_CYEDGE) / 2); /* FIXME: Query metrics */ + /* We're not going to allow task bands where not even the minimum button size fits into the band */ + pdbi->ptMinSize.x = pdbi->ptIntegral.y; + } + + /* Ignored: pdbi->ptMaxSize.x */ + pdbi->ptMaxSize.y = -1; + + /* FIXME: We should query the height from the task bar object!!! */ + pdbi->ptActual.y = GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE)); + + /* Save the band ID for future use in case we need to check whether a given band + is the task band */ + m_BandID = dwBandID; + + TRACE("H: %d, Min: %d,%d, Integral.y: %d Actual: %d,%d\n", (dwViewMode & DBIF_VIEWMODE_VERTICAL) == 0, + pdbi->ptMinSize.x, pdbi->ptMinSize.y, pdbi->ptIntegral.y, + pdbi->ptActual.x, pdbi->ptActual.y); + + return S_OK; + } + return E_FAIL; }
@@ -141,6 +220,8 @@ IN IUnknown *punkClient) { TRACE("IDeskBar::SetClient(0x%p)\n", punkClient); + + //MessageBox(0, L"SetClient called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return E_NOTIMPL; }
@@ -148,16 +229,19 @@ OUT IUnknown **ppunkClient) { TRACE("IDeskBar::GetClient(0x%p)\n", ppunkClient); + + //MessageBox(0, L"GetClient called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE CQuickLaunchBand::OnPosRectChangeDB( IN RECT *prc) { - /*TRACE("IDeskBar::OnPosRectChangeDB(0x%p=(%d,%d,%d,%d))\n", prc, prc->left, prc->top, prc->right, prc->bottom); + TRACE("IDeskBar::OnPosRectChangeDB(0x%p=(%d,%d,%d,%d))\n", prc, prc->left, prc->top, prc->right, prc->bottom); if (prc->bottom - prc->top == 0) - return S_OK;*/ - + return S_OK; + + //MessageBox(0, L"OnPosRectChangeDB called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return S_FALSE; }
@@ -166,15 +250,19 @@ HRESULT STDMETHODCALLTYPE CQuickLaunchBand::GetClassID( OUT CLSID *pClassID) { + //MessageBox(0, L"GetClassID called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); TRACE("CQuickLaunchBand::GetClassID(0x%p)\n", pClassID); - /* We're going to return the (internal!) CLSID of the task band interface */ + /* We're going to return the (internal!) CLSID of the quick launch band */ *pClassID = CLSID_QuickLaunchBand; + return S_OK; }
HRESULT STDMETHODCALLTYPE CQuickLaunchBand::IsDirty() { /* The object hasn't changed since the last save! */ + + //MessageBox(0, L"IsDirty called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return S_FALSE; }
@@ -183,6 +271,8 @@ { TRACE("CQuickLaunchBand::Load called\n"); /* Nothing to do */ + + //MessageBox(0, L"Load called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return S_OK; }
@@ -191,6 +281,8 @@ IN BOOL fClearDirty) { /* Nothing to do */ + + //MessageBox(0, L"Save called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return S_OK; }
@@ -200,6 +292,8 @@ TRACE("CQuickLaunchBand::GetSizeMax called\n"); /* We don't need any space for the task band */ //pcbSize->QuadPart = 0; + + //MessageBox(0, L"GetSizeMax called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return S_OK; }
@@ -214,30 +308,36 @@ OUT LRESULT *plrResult) { TRACE("CQuickLaunchBand: IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p)\n", hWnd, uMsg, wParam, lParam, plrResult); + + //MessageBox(0, L"ProcessMessage called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE CQuickLaunchBand::ContainsWindow( IN HWND hWnd) { - /*if (hWnd == m_hWnd || + //MessageBox(0, L"ContainsWindow called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); + + if (hWnd == m_hWnd || IsChild(m_hWnd, hWnd)) { TRACE("CQuickLaunchBand::ContainsWindow(0x%p) returns S_OK\n", hWnd); return S_OK; - }*/ + }
return S_FALSE; }
HRESULT STDMETHODCALLTYPE CQuickLaunchBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) - { - UNIMPLEMENTED; + { + //MessageBox(0, L"OnWinEvent called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); + UNIMPLEMENTED; return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE CQuickLaunchBand::IsWindowOwner(HWND hWnd) { + //MessageBox(0, L"IsWindowOwner called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return (hWnd == m_hWnd) ? S_OK : S_FALSE; }
@@ -245,13 +345,14 @@ // *** IOleCommandTarget methods *** HRESULT STDMETHODCALLTYPE CQuickLaunchBand::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText) { + //MessageBox(0, L"QueryStatus called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); UNIMPLEMENTED; return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE CQuickLaunchBand::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) { - /*if (IsEqualIID(*pguidCmdGroup, IID_IBandSite)) + if (IsEqualIID(*pguidCmdGroup, IID_IBandSite)) { return S_OK; } @@ -259,9 +360,11 @@ if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand)) { return S_OK; - }*/ - + } + + //MessageBox(0, L"Exec called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); UNIMPLEMENTED; + 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] Thu Jun 8 15:18:21 2017 @@ -9,8 +9,11 @@
extern const GUID CLSID_QuickLaunchBand;
+//Component category registration HRESULT RegisterComCat(); +HRESULT UnregisterComCat();
+//COM class for quick launch class CQuickLaunchBand : public CComCoClass<CQuickLaunchBand, &CLSID_QuickLaunchBand>, public CComObjectRootEx<CComMultiThreadModelNoCS>, @@ -21,13 +24,16 @@ public IWinEventHandler, public IOleCommandTarget { + CComPtr<IUnknown> m_Site; + HINSTANCE m_hInstance; HWND m_hWnd; + HWND m_hWndStartButton; DWORD m_BandID;
public:
CQuickLaunchBand(); - virtual ~CQuickLaunchBand(); + virtual ~CQuickLaunchBand();
//IObjectWithSite
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] Thu Jun 8 15:18:21 2017 @@ -38,16 +38,4 @@
#undef DbgPrint
-#include "CQuickLaunchBand.h" - -/*extern HINSTANCE g_hInstance; - -#define ID_ICON_VOLUME (WM_APP + 0x4CB) - -// {845B0FB2-66E0-416B-8F91-314E23F7C12D} -DEFINE_GUID(CLSID_NtObjectFolder, - 0x845b0fb2, 0x66e0, 0x416b, 0x8f, 0x91, 0x31, 0x4e, 0x23, 0xf7, 0xc1, 0x2d); - -//#include "ntobjfolder.h" -//#include "regfolder.h" -*/ +#include "CQuickLaunchBand.h"
Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/qcklnch.cpp URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/s... ============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/qcklnch.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/qcklnch.cpp [iso-8859-1] Thu Jun 8 15:18:21 2017 @@ -56,7 +56,12 @@ STDAPI DllUnregisterServer(void) { - return g_Module.DllUnregisterServer(FALSE); + HRESULT hr = g_Module.DllUnregisterServer(FALSE); + + if (FAILED(hr)) + return hr; + else + return UnregisterComCat(); }
STDAPI
Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/rgs/qcklnch.rgs URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/s... ============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/rgs/qcklnch.rgs [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/rgs/qcklnch.rgs [iso-8859-1] Thu Jun 8 15:18:21 2017 @@ -2,7 +2,7 @@ { NoRemove CLSID { - ForceRemove {260CB95D-4544-44F6-A079-575BAA60B72F} = s 'QuickLaunchBand' + ForceRemove {260CB95D-4544-44F6-A079-575BAA60B72F} = s 'Quick Launch' { InprocServer32 = s '%MODULE%' {
Modified: branches/GSoC_2017/shellext/reactos/media/inf/syssetup.inf URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/media... ============================================================================== --- branches/GSoC_2017/shellext/reactos/media/inf/syssetup.inf [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/media/inf/syssetup.inf [iso-8859-1] Thu Jun 8 15:18:21 2017 @@ -85,6 +85,7 @@ 11,,olepro32.dll,1 11,,propsys.dll,1 11,,pstorec.dll,1 +11,,qcklnch.dll,1 11,,qedit.dll,1 11,,qmgr.dll,1 11,,qmgrprxy.dll,1