Changeset 36
- Timestamp:
- 10/11/2007 2:02:40 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/Erasext/ErasextMenu.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Erasext/ErasextMenu.cpp
r32 r36 1 1 // ErasextMenu.cpp 2 // $Id$ 2 3 // 3 4 // Eraser. Secure data removal. For Windows. 4 5 // Copyright © 1997-2001 Sami Tolvanen (sami@tolvanen.com). 6 // Copyright © 2007 The Eraser Project. 5 7 // 6 8 // This program is free software; you can redistribute it and/or … … 192 194 STDMETHODIMP CErasextMenu::XMenuExt::QueryContextMenu(HMENU hMenu, UINT nIndex, UINT idCmdFirst, UINT /*idCmdLast*/, UINT uFlags) 193 195 { 194 METHOD_PROLOGUE(CErasextMenu, MenuExt); 195 196 // do not show menu for shortcuts or when the shell 197 // wants only the default item, or if the user has disabled 198 // the shell extension 199 200 CKey kReg; 201 BOOL bEnabled = TRUE; 202 203 if (kReg.Open(HKEY_CURRENT_USER, ERASER_REGISTRY_BASE)) 204 { 205 kReg.GetValue(bEnabled, ERASEXT_REGISTRY_ENABLED, TRUE); 206 kReg.Close(); 207 } 208 209 if (bEnabled && (uFlags & CMF_VERBSONLY) == 0 && (uFlags & CMF_DEFAULTONLY) == 0) 210 { 211 CString str; 212 213 try 214 { 215 if (pThis->m_bDragMenu) 216 { 217 if (pThis->m_bUseFiles) 218 str.LoadString(IDS_MENU_TEXT_DRAG); 219 else 220 return ResultFromShort(0); 221 } 222 else 223 { 224 if (!pThis->m_bUseFiles) 225 str.LoadString(IDS_MENU_TEXT_DRIVE); 226 else 227 str.LoadString(IDS_MENU_TEXT_FILE); 228 } 229 230 if (!InsertMenu(hMenu, nIndex++, MF_SEPARATOR| MF_BYPOSITION, idCmdFirst, "")) 196 METHOD_PROLOGUE(CErasextMenu, MenuExt); 197 198 // do not show menu for shortcuts or when the shell 199 // wants only the default item, or if the user has disabled 200 // the shell extension 201 202 CKey kReg; 203 BOOL bEnabled = TRUE; 204 205 if (kReg.Open(HKEY_CURRENT_USER, ERASER_REGISTRY_BASE)) 206 { 207 kReg.GetValue(bEnabled, ERASEXT_REGISTRY_ENABLED, TRUE); 208 kReg.Close(); 209 } 210 211 if (bEnabled && (uFlags & CMF_VERBSONLY) == 0 && (uFlags & CMF_DEFAULTONLY) == 0) 212 { 213 CString str; 214 215 try 216 { 217 UINT startIndex = nIndex; 218 if (!pThis->m_bDragMenu) 219 { 220 if (!InsertMenu(hMenu, nIndex++, MF_SEPARATOR | MF_BYPOSITION, idCmdFirst , "")) 221 return ResultFromShort(0); 222 223 if (!pThis->m_bUseFiles) 224 str.LoadString(IDS_MENU_TEXT_DRIVE); 225 else 226 str.LoadString(IDS_MENU_TEXT_FILE); 227 228 str = setShortcut(str); 229 if (!InsertMenu(hMenu, nIndex++ , MF_STRING | MF_BYPOSITION, idCmdFirst + CMD_ERASE, str)) 230 return ResultFromShort(0); 231 } 232 233 if (pThis->m_bUseFiles) 234 { 235 str.LoadString(IDS_MENU_TEXT_DRAG); 236 str = setShortcut(str); 237 if (!InsertMenu(hMenu, nIndex++ , MF_STRING | MF_BYPOSITION, idCmdFirst + CMD_MOVE, str)) 238 return ResultFromShort(0); 239 } 240 241 if (!InsertMenu(hMenu, nIndex++, MF_SEPARATOR | MF_BYPOSITION, idCmdFirst , "")) 231 242 return ResultFromShort(0); 232 243 233 234 str = setShortcut(str); 235 if (!InsertMenu(hMenu, nIndex++ , MF_STRING | MF_BYPOSITION , idCmdFirst + CMD_ERASE, str)) 236 return ResultFromShort(0); 237 238 CString moveStr; 239 //ASSERT(moveStr.LoadString(IDS_MENU_TEXT_DRAG)); 240 moveStr.LoadString(IDS_MENU_TEXT_DRAG); 241 242 moveStr = setShortcut(moveStr); 243 if (!InsertMenu(hMenu, nIndex++, MF_STRING | MF_BYPOSITION, idCmdFirst + CMD_MOVE, moveStr)) 244 return ResultFromShort(0); 245 246 247 if (!InsertMenu(hMenu, nIndex++, MF_SEPARATOR| MF_BYPOSITION, idCmdFirst , "")) 248 return ResultFromShort(0); 249 250 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, CMD_MOVE + 1); 251 } 252 catch (CException *e) 253 { 254 ASSERT(FALSE); 255 256 e->ReportError(MB_ICONERROR); 257 e->Delete(); 258 } 259 catch (...) 260 { 261 ASSERT(FALSE); 262 } 263 } 264 265 return ResultFromShort(0); 244 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, nIndex - startIndex); 245 } 246 catch (CException *e) 247 { 248 ASSERT(FALSE); 249 250 e->ReportError(MB_ICONERROR); 251 e->Delete(); 252 } 253 catch (...) 254 { 255 ASSERT(FALSE); 256 } 257 } 258 259 return ResultFromShort(0); 266 260 } 267 261
Note: See TracChangeset
for help on using the changeset viewer.
