View the DQSD CVS repository here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dqsd/
Update of /cvsroot/dqsd/dqsd/src/DQSDTools
In directory usw-pr-cvs1:/tmp/cvs-serv3514/src/DQSDTools
Modified Files:
DQSDTools.idl Launcher.cpp Launcher.h MenuBuilder.cpp
MenuBuilder.h
Log Message:
added InstallationProperty to ILauncher
added 6 functions to IMenuBuilder to support finding and inserting menu items and
submenus
Index: DQSDTools.idl
===================================================================
RCS file: /cvsroot/dqsd/dqsd/src/DQSDTools/DQSDTools.idl,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** DQSDTools.idl 23 Jul 2002 21:34:19 -0000 1.20
--- DQSDTools.idl 16 Oct 2002 05:16:54 -0000 1.21
***************
*** 32,35 ****
--- 32,36 ----
[id(14), helpstring("method ShutdownBar")] HRESULT ShutdownBar([in]
LPDISPATCH pDispDocument);
[id(15), helpstring("Attempt to refresh taskbar tray icons")] HRESULT
RefreshTrayIcons();
+ [propget, id(16), helpstring("property InstallationDirectory")]
+HRESULT InstallationDirectory([out,retval] BSTR *pbstrDirectory);
};
[
***************
*** 49,52 ****
--- 50,59 ----
[propput, id(5), helpstring("property HorizontalAlignment")] HRESULT
HorizontalAlignment([in] short newVal);
[id(6), helpstring("method InitialiseTooltips")] HRESULT
InitialiseTooltips([in] long displayTimeMultiplier);
+ [id(7), helpstring("method InsertMenuItem")] HRESULT
+InsertMenuItem([in] BSTR bstrItem, [in] BSTR bstrKey, [in] BSTR bstrToolTip, [in]
+UINT position, [in,optional] VARIANT* hmenu);
+ [id(8), helpstring("method InsertSeparator")] HRESULT
+InsertSeparator([in] UINT position, [in] long hmenu);
+ [id(9), helpstring("method InsertSubMenu")] HRESULT InsertSubMenu([in]
+BSTR bstrName, [in] UINT position, [in,optional] VARIANT* hParentMenu, [out,retval]
+long* phmenu);
+ [id(10), helpstring("method GetMenuItemCount")] HRESULT
+GetMenuItemCount([in] long hmenu, [out,retval] long* pCount);
+ [id(11), helpstring("method FindSubMenu")] HRESULT FindSubMenu([in]
+BSTR bstrName, [in,optional] VARIANT* hParentMenu, [out,retval] long* phmenu);
+ [id(12), helpstring("method FindMenuItem")] HRESULT FindMenuItem([in]
+BSTR bstrName, [in,optional] VARIANT* hParentMenu, [out,retval] long* pPosition);
};
Index: Launcher.cpp
===================================================================
RCS file: /cvsroot/dqsd/dqsd/src/DQSDTools/Launcher.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** Launcher.cpp 23 Jul 2002 22:39:55 -0000 1.32
--- Launcher.cpp 16 Oct 2002 05:16:54 -0000 1.33
***************
*** 614,615 ****
--- 614,640 ----
return S_OK;
}
+
+ STDMETHODIMP CLauncher::get_InstallationDirectory(BSTR* pbstrDirectory)
+ {
+ USES_CONVERSION;
+
+ // Get the installation directory from the registry
+ CRegKey rk;
+ if ( ERROR_SUCCESS != rk.Open( HKEY_CLASSES_ROOT, DQSD_REG_KEY, KEY_READ ) )
+ {
+ Error(IDS_ERR_REGKEYNOTFOUND, IID_ILauncher);
+ return E_UNEXPECTED;
+ }
+
+ TCHAR szInstallDir[ _MAX_PATH ];
+ DWORD dwCount = sizeof( szInstallDir );
+ if ( ERROR_SUCCESS != rk.QueryValue( szInstallDir, _T("InstallDir"), &dwCount
+) )
+ {
+ Error(IDS_ERR_REGKEYNOTFOUND, IID_ILauncher);
+ return E_UNEXPECTED;
+ }
+ CComBSTR bstrInstallDir;
+ bstrInstallDir.Append(szInstallDir);
+ *pbstrDirectory = bstrInstallDir.Detach();
+ return S_OK;
+ }
\ No newline at end of file
Index: Launcher.h
===================================================================
RCS file: /cvsroot/dqsd/dqsd/src/DQSDTools/Launcher.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Launcher.h 23 Jul 2002 21:34:19 -0000 1.18
--- Launcher.h 16 Oct 2002 05:16:54 -0000 1.19
***************
*** 76,79 ****
--- 76,80 ----
STDMETHOD(GetProtocolHandler)(/*[in]*/ BSTR bstrProtocol, /*[out,retval]*/
BSTR* pbstrHandler);
STDMETHOD(GetFiles)(/*[in]*/ BSTR bstrFileSpec, /*[out,retval]*/ BSTR*
pbstrFiles);
+ STDMETHOD(get_InstallationDirectory)(/*[out,retval]*/ BSTR* pbstrDirectory);
public:
Index: MenuBuilder.cpp
===================================================================
RCS file: /cvsroot/dqsd/dqsd/src/DQSDTools/MenuBuilder.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** MenuBuilder.cpp 4 Oct 2002 08:52:59 -0000 1.16
--- MenuBuilder.cpp 16 Oct 2002 05:16:54 -0000 1.17
***************
*** 146,153 ****
}
! BOOL bSuccess = ::AppendMenu( hmenu, MF_STRING, ++m_nMenuItem, W2T( bstrItem )
);
if ( !bSuccess )
return E_FAIL;
m_mapKeys[ m_nMenuItem ] = std::string( W2T( bstrKey ) );
m_toolTips[m_nMenuItem] = std::string( W2T( bstrToolTip ) );
--- 146,154 ----
}
! BOOL bSuccess = ::AppendMenu( hmenu, MF_STRING, m_nMenuItem+1, W2T( bstrItem )
);
if ( !bSuccess )
return E_FAIL;
+ m_nMenuItem++;
m_mapKeys[ m_nMenuItem ] = std::string( W2T( bstrKey ) );
m_toolTips[m_nMenuItem] = std::string( W2T( bstrToolTip ) );
***************
*** 294,298 ****
cursorPos.y = GET_Y_LPARAM(messagePos);
! int nItems = GetMenuItemCount(hMenu);
int nItemPosition;
for(nItemPosition = 0; nItemPosition < nItems;
nItemPosition++)
--- 295,299 ----
cursorPos.y = GET_Y_LPARAM(messagePos);
! int nItems = ::GetMenuItemCount(hMenu);
int nItemPosition;
for(nItemPosition = 0; nItemPosition < nItems;
nItemPosition++)
***************
*** 554,555 ****
--- 555,713 ----
return S_OK;
}
+
+ STDMETHODIMP CMenuBuilder::InsertMenuItem(BSTR bstrItem, BSTR bstrKey, BSTR
+bstrToolTip, UINT position, VARIANT* pvhMenu )
+ {
+ USES_CONVERSION;
+
+ HMENU hmenu = (HMENU)m_hMain;
+ if (pvhMenu && ((VT_I4 == pvhMenu->vt) || (VT_I2 == pvhMenu->vt)) )
+ {
+ hmenu = pvhMenu->intVal ? (HMENU)pvhMenu->intVal : (HMENU)m_hMain;
+ }
+
+ MENUITEMINFO menuItem;
+ memset(&menuItem, 0, sizeof(MENUITEMINFO));
+ menuItem.cbSize = sizeof(MENUITEMINFO);
+ menuItem.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID;
+ menuItem.fType = MFT_STRING;
+ menuItem.fState = MFS_ENABLED;
+ menuItem.wID = (m_nMenuItem+1);
+ menuItem.dwTypeData = W2T( bstrItem );
+ menuItem.cch = lstrlen( W2T( bstrItem) );
+
+ BOOL bSuccess = ::InsertMenuItem( hmenu, position, TRUE, &menuItem);
+ if ( !bSuccess)
+ return E_FAIL;
+
+ m_nMenuItem++;
+ m_mapKeys[ m_nMenuItem ] = std::string( W2T( bstrKey ) );
+ m_toolTips[m_nMenuItem] = std::string( W2T( bstrToolTip ) );
+
+ return S_OK;
+ }
+
+ STDMETHODIMP CMenuBuilder::InsertSeparator(UINT position, long hmenu)
+ {
+ USES_CONVERSION;
+
+ MENUITEMINFO menuItem;
+ memset(&menuItem, 0, sizeof(MENUITEMINFO));
+ menuItem.cbSize = sizeof(MENUITEMINFO);
+ menuItem.fMask = MIIM_TYPE | MIIM_STATE;
+ menuItem.fType = MFT_SEPARATOR;
+ menuItem.fState = MFS_ENABLED;
+
+ BOOL bSuccess = ::InsertMenuItem( (HMENU)hmenu, position, TRUE, &menuItem);
+ if ( !bSuccess)
+ return E_FAIL;
+
+ return S_OK;
+ }
+
+ STDMETHODIMP CMenuBuilder::InsertSubMenu(BSTR bstrName, UINT position, VARIANT*
+pvParentMenu, long *phmenu)
+ {
+ *phmenu = (long)::CreatePopupMenu();
+
+ USES_CONVERSION;
+
+ HMENU hmenu = (HMENU)m_hMain;
+ if (pvParentMenu && ((VT_I4 == pvParentMenu->vt) || (VT_I2 ==
+pvParentMenu->vt)) )
+ {
+ hmenu = pvParentMenu->intVal ? (HMENU)pvParentMenu->intVal :
+(HMENU)m_hMain;
+ }
+
+ MENUITEMINFO menuItem;
+ memset(&menuItem, 0, sizeof(MENUITEMINFO));
+ menuItem.cbSize = sizeof(MENUITEMINFO);
+ menuItem.fMask = MIIM_TYPE | MIIM_STATE | MIIM_SUBMENU;
+ menuItem.fType = MFT_STRING;
+ menuItem.fState = MFS_ENABLED;
+ menuItem.hSubMenu = (HMENU)*phmenu;
+ menuItem.dwTypeData = W2T( bstrName );
+ menuItem.cch = lstrlen( W2T( bstrName) );
+
+ BOOL bSuccess = ::InsertMenuItem( (HMENU)hmenu, position, TRUE, &menuItem);
+ if ( !bSuccess)
+ return E_FAIL;
+
+ return S_OK;
+ }
+
+ STDMETHODIMP CMenuBuilder::GetMenuItemCount(long hmenu, long *pCount)
+ {
+ USES_CONVERSION;
+
+ int retval = ::GetMenuItemCount((HMENU)hmenu);
+ if (retval == -1)
+ {
+ return Error(_T("Invalid menu handle"), IID_IMenuBuilder, E_FAIL);
+ }
+ *pCount = (long)retval;
+ return S_OK;
+ }
+
+ STDMETHODIMP CMenuBuilder::FindSubMenu(BSTR bstrName, VARIANT* pvParentMenu, long
+*phmenu)
+ {
+ USES_CONVERSION;
+
+ *phmenu = -1;
+
+ HMENU hmenu = (HMENU)m_hMain;
+ if (pvParentMenu && ((VT_I4 == pvParentMenu->vt) || (VT_I2 ==
+pvParentMenu->vt)) )
+ {
+ hmenu = pvParentMenu->intVal ? (HMENU)pvParentMenu->intVal :
+(HMENU)m_hMain;
+ }
+
+ int nItems = ::GetMenuItemCount(hmenu);
+ int nItemPosition;
+ for(nItemPosition = 0; nItemPosition < nItems; nItemPosition++)
+ {
+ TCHAR menuName[101];
+ int len = ::GetMenuString(hmenu, nItemPosition, menuName, 100,
+MF_BYPOSITION);
+ if (len != 0)
+ {
+ if (lstrcmp(W2T(bstrName), menuName)==0)
+ {
+ *phmenu = (long)::GetSubMenu(hmenu, nItemPosition);
+ if (*phmenu == 0)
+ {
+ *phmenu = -1;
+ }
+ break;
+ }
+ }
+ }
+
+ return S_OK;
+ }
+
+ STDMETHODIMP CMenuBuilder::FindMenuItem(BSTR bstrName, VARIANT* pvParentMenu, long
+*pPosition)
+ {
+ USES_CONVERSION;
+
+ *pPosition = -1;
+
+ HMENU hmenu = (HMENU)m_hMain;
+ if (pvParentMenu && ((VT_I4 == pvParentMenu->vt) || (VT_I2 ==
+pvParentMenu->vt)) )
+ {
+ hmenu = pvParentMenu->intVal ? (HMENU)pvParentMenu->intVal :
+(HMENU)m_hMain;
+ }
+
+ int nItems = ::GetMenuItemCount(hmenu);
+ int nItemPosition;
+ for(nItemPosition = 0; nItemPosition < nItems; nItemPosition++)
+ {
+ TCHAR menuName[101];
+ int len = ::GetMenuString(hmenu, nItemPosition, menuName, 100,
+MF_BYPOSITION);
+ if (len != 0)
+ {
+ if (lstrcmp(W2T(bstrName), menuName)==0)
+ {
+ *pPosition = (long)nItemPosition;
+ break;
+ }
+ }
+ }
+ return S_OK;
+ }
+
Index: MenuBuilder.h
===================================================================
RCS file: /cvsroot/dqsd/dqsd/src/DQSDTools/MenuBuilder.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** MenuBuilder.h 8 Jul 2002 10:32:04 -0000 1.9
--- MenuBuilder.h 16 Oct 2002 05:16:54 -0000 1.10
***************
*** 67,70 ****
--- 67,76 ----
STDMETHOD(AppendSeparator)(/*[in]*/ long hmenu);
STDMETHOD(Display)(LPDISPATCH pDispDocument, VARIANT* pbstrSelection);
+ STDMETHOD(InsertMenuItem)(/*[in]*/ BSTR bstrItem, /*[in]*/ BSTR bstrKey,
+/*[in]*/ BSTR bstrToolTip, /*[in]*/ UINT position, /*[in,optional]*/ VARIANT* pvhMenu
+);
+ STDMETHOD(InsertSeparator)(/*[in]*/ UINT position, /*[in]*/ long hmenu);
+ STDMETHOD(InsertSubMenu)(/*[in]*/ BSTR bstrName, /*[in]*/ UINT position,
+/*[in,optional]*/ VARIANT* pvParentMenu, /*[out,retval]*/ long *phmenu);
+ STDMETHOD(GetMenuItemCount)(/*[in]*/ long hmenu, /*[out,retval]*/ long
+*pCount);
+ STDMETHOD(FindSubMenu)(/*[in]*/ BSTR bstrName, /*[in,optional]*/ VARIANT*
+pvParentMenu, /*[out,retval]*/ long *phmenu);
+ STDMETHOD(FindMenuItem)(/*[in]*/ BSTR bstrName, /*[in,optional]*/ VARIANT*
+pvParentMenu, /*[out,retval]*/ long *pPosition);
// Implementation
-------------------------------------------------------
This sf.net email is sponsored by: viaVerio will pay you up to
$1,000 for every account that you consolidate with us.
http://ad.doubleclick.net/clk;4749864;7604308;v?
http://www.viaverio.com/consolidator/osdn.cfm
_______________________________________________
DQSD-CVS mailing list
https://lists.sourceforge.net/lists/listinfo/dqsd-cvs
DQSD CVS repository:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dqsd/