Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-2001.
  5. //
  6. // File: App.cpp
  7. //
  8. // Contents:
  9. //
  10. //----------------------------------------------------------------------------
  11. // App.cpp : Implementation of CSendConsoleMessageApp snapin
  12. #include "stdafx.h"
  13. #include "debug.h"
  14. #include "util.h"
  15. #include "resource.h"
  16. #include "SendCMsg.h"
  17. #include "dialogs.h"
  18. #include "App.h"
  19. // Menu IDs
  20. #define cmSendConsoleMessage 100 // Menu Command Id to invoke the dialog
  21. /////////////////////////////////////////////////////////////////////
  22. // CSendConsoleMessageApp::IExtendContextMenu::AddMenuItems()
  23. STDMETHODIMP
  24. CSendConsoleMessageApp::AddMenuItems(
  25. IN IDataObject * /*pDataObject*/,
  26. OUT IContextMenuCallback * pContextMenuCallback,
  27. INOUT long * /*pInsertionAllowed*/)
  28. {
  29. HRESULT hr;
  30. CONTEXTMENUITEM cmiSeparator = { 0 };
  31. cmiSeparator.lInsertionPointID = CCM_INSERTIONPOINTID_3RDPARTY_TASK;
  32. cmiSeparator.fSpecialFlags = CCM_SPECIAL_SEPARATOR;
  33. hr = pContextMenuCallback->AddItem(IN &cmiSeparator);
  34. Assert(SUCCEEDED(hr));
  35. TCHAR szMenuItem[128];
  36. TCHAR szStatusBarText[256];
  37. CchLoadString(IDS_MENU_SEND_MESSAGE, OUT szMenuItem, LENGTH(szMenuItem));
  38. CchLoadString(IDS_STATUS_SEND_MESSAGE, OUT szStatusBarText, LENGTH(szStatusBarText));
  39. CONTEXTMENUITEM cmi = { 0 };
  40. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_3RDPARTY_TASK;
  41. cmi.lCommandID = cmSendConsoleMessage;
  42. cmi.strName = szMenuItem;
  43. cmi.strStatusBarText = szStatusBarText;
  44. hr = pContextMenuCallback->AddItem(IN &cmi);
  45. Assert(SUCCEEDED(hr));
  46. hr = pContextMenuCallback->AddItem(IN &cmiSeparator);
  47. Assert(SUCCEEDED(hr));
  48. return S_OK;
  49. }
  50. /////////////////////////////////////////////////////////////////////
  51. // CSendConsoleMessageApp::IExtendContextMenu::Command()
  52. STDMETHODIMP
  53. CSendConsoleMessageApp::Command(LONG lCommandID, IDataObject * pDataObject)
  54. {
  55. if (lCommandID == cmSendConsoleMessage)
  56. {
  57. (void)DoDialogBox(
  58. IDD_SEND_CONSOLE_MESSAGE,
  59. ::GetActiveWindow(),
  60. (DLGPROC)CSendConsoleMessageDlg::DlgProc,
  61. (LPARAM)pDataObject);
  62. }
  63. return S_OK;
  64. }