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.

91 lines
1.7 KiB

  1. // Copyright (c) 2000 Microsoft Corporation
  2. //
  3. // multi-line edit box control wrapper
  4. //
  5. // 22 Nov 2000 sburns
  6. //
  7. // added to fix NTRAID#NTBUG9-232092-2000/11/22-sburns
  8. #include "headers.hxx"
  9. #include "MultiLineEditBoxThatForwardsEnterKey.hpp"
  10. MultiLineEditBoxThatForwardsEnterKey::MultiLineEditBoxThatForwardsEnterKey()
  11. {
  12. LOG_CTOR(MultiLineEditBoxThatForwardsEnterKey);
  13. }
  14. MultiLineEditBoxThatForwardsEnterKey::~MultiLineEditBoxThatForwardsEnterKey()
  15. {
  16. LOG_DTOR(MultiLineEditBoxThatForwardsEnterKey);
  17. }
  18. HRESULT
  19. MultiLineEditBoxThatForwardsEnterKey::Init(HWND editControl)
  20. {
  21. LOG_FUNCTION(MultiLineEditBoxThatForwardsEnterKey::Init);
  22. ASSERT(Win::GetClassName(editControl) == L"Edit");
  23. HRESULT hr = ControlSubclasser::Init(editControl);
  24. return hr;
  25. }
  26. LRESULT
  27. MultiLineEditBoxThatForwardsEnterKey::OnMessage(
  28. UINT message,
  29. WPARAM wparam,
  30. LPARAM lparam)
  31. {
  32. // LOG_FUNCTION(MultiLineEditBoxThatForwardsEnterKey::OnMessage);
  33. switch (message)
  34. {
  35. case WM_KEYDOWN:
  36. {
  37. switch (wparam)
  38. {
  39. case VK_RETURN:
  40. {
  41. // Send the parent window a WM_COMMAND message with IDOK as
  42. // the notification code.
  43. Win::SendMessage(
  44. Win::GetParent(hwnd),
  45. WM_COMMAND,
  46. MAKELONG(::GetDlgCtrlID(hwnd), FORWARDED_ENTER),
  47. reinterpret_cast<LPARAM>(hwnd));
  48. break;
  49. }
  50. default:
  51. {
  52. // do nothing
  53. break;
  54. }
  55. }
  56. break;
  57. }
  58. default:
  59. {
  60. // do nothing
  61. break;
  62. }
  63. }
  64. return ControlSubclasser::OnMessage(message, wparam, lparam);
  65. }