Leaked source code of windows server 2003
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.

149 lines
4.0 KiB

  1. //
  2. // msgpump.cpp
  3. //
  4. #include "private.h"
  5. #include "tim.h"
  6. //+---------------------------------------------------------------------------
  7. //
  8. // PeekMessageA
  9. //
  10. //----------------------------------------------------------------------------
  11. STDAPI CThreadInputMgr::PeekMessageA(LPMSG pMsg, HWND hwnd, UINT wMsgFilterMin,
  12. UINT wMsgFilterMax, UINT wRemoveMsg, BOOL *pfResult)
  13. {
  14. if (pfResult == NULL)
  15. return E_INVALIDARG;
  16. Assert(_cAppWantsKeystrokesRef >= 0); // ref count is never negative!
  17. _cAppWantsKeystrokesRef++;
  18. *pfResult = ::PeekMessageA(pMsg, hwnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
  19. _cAppWantsKeystrokesRef--;
  20. return S_OK;
  21. }
  22. //+---------------------------------------------------------------------------
  23. //
  24. // GetMessageA
  25. //
  26. //----------------------------------------------------------------------------
  27. STDAPI CThreadInputMgr::GetMessageA(LPMSG pMsg, HWND hwnd, UINT wMsgFilterMin,
  28. UINT wMsgFilterMax, BOOL *pfResult)
  29. {
  30. if (pfResult == NULL)
  31. return E_INVALIDARG;
  32. Assert(_cAppWantsKeystrokesRef >= 0); // ref count is never negative!
  33. _cAppWantsKeystrokesRef++;
  34. Perf_StartStroke(PERF_STROKE_GETMSG);
  35. *pfResult = ::GetMessageA(pMsg, hwnd, wMsgFilterMin, wMsgFilterMax);
  36. Perf_EndStroke(PERF_STROKE_GETMSG);
  37. _cAppWantsKeystrokesRef--;
  38. return S_OK;
  39. }
  40. //+---------------------------------------------------------------------------
  41. //
  42. // PeekMessageW
  43. //
  44. //----------------------------------------------------------------------------
  45. STDAPI CThreadInputMgr::PeekMessageW(LPMSG pMsg, HWND hwnd, UINT wMsgFilterMin,
  46. UINT wMsgFilterMax, UINT wRemoveMsg, BOOL *pfResult)
  47. {
  48. if (pfResult == NULL)
  49. return E_INVALIDARG;
  50. Assert(_cAppWantsKeystrokesRef >= 0); // ref count is never negative!
  51. _cAppWantsKeystrokesRef++;
  52. *pfResult = ::PeekMessageW(pMsg, hwnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
  53. _cAppWantsKeystrokesRef--;
  54. return S_OK;
  55. }
  56. //+---------------------------------------------------------------------------
  57. //
  58. // GetMessageW
  59. //
  60. //----------------------------------------------------------------------------
  61. STDAPI CThreadInputMgr::GetMessageW(LPMSG pMsg, HWND hwnd, UINT wMsgFilterMin,
  62. UINT wMsgFilterMax, BOOL *pfResult)
  63. {
  64. if (pfResult == NULL)
  65. return E_INVALIDARG;
  66. Assert(_cAppWantsKeystrokesRef >= 0); // ref count is never negative!
  67. _cAppWantsKeystrokesRef++;
  68. Perf_StartStroke(PERF_STROKE_GETMSG);
  69. *pfResult = ::GetMessageW(pMsg, hwnd, wMsgFilterMin, wMsgFilterMax);
  70. Perf_EndStroke(PERF_STROKE_GETMSG);
  71. _cAppWantsKeystrokesRef--;
  72. return S_OK;
  73. }
  74. //+---------------------------------------------------------------------------
  75. //
  76. // EnableSystemKeystrokeFeed
  77. //
  78. //----------------------------------------------------------------------------
  79. STDAPI CThreadInputMgr::EnableSystemKeystrokeFeed()
  80. {
  81. if (_cDisableSystemKeystrokeFeedRef <= 0)
  82. {
  83. Assert(0); // bogus ref count!
  84. return E_UNEXPECTED;
  85. }
  86. _cDisableSystemKeystrokeFeedRef--;
  87. return S_OK;
  88. }
  89. //+---------------------------------------------------------------------------
  90. //
  91. // DisableSystemKeystrokeFeed
  92. //
  93. //----------------------------------------------------------------------------
  94. STDAPI CThreadInputMgr::DisableSystemKeystrokeFeed()
  95. {
  96. _cDisableSystemKeystrokeFeedRef++;
  97. return S_OK;
  98. }
  99. //+---------------------------------------------------------------------------
  100. //
  101. // IsKeystrokeFeedEnabled
  102. //
  103. // nb: this method is on a private interface used by the aimm layer.
  104. //----------------------------------------------------------------------------
  105. STDAPI CThreadInputMgr::IsKeystrokeFeedEnabled(BOOL *pfEnabled)
  106. {
  107. Assert(pfEnabled != NULL);
  108. *pfEnabled = _IsKeystrokeFeedEnabled();
  109. return S_OK;
  110. }