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.

103 lines
2.2 KiB

  1. #include "pch.hxx"
  2. #include "inpobj.h"
  3. #include <shlguid.h>
  4. // IInputObject helpers
  5. HRESULT UnkHasFocusIO(IUnknown *punkThis)
  6. {
  7. HRESULT hres = E_FAIL;
  8. if (punkThis != NULL)
  9. {
  10. IInputObject *pio;
  11. hres = punkThis->QueryInterface(IID_IInputObject, (LPVOID*)&pio);
  12. if (SUCCEEDED(hres))
  13. {
  14. hres = pio->HasFocusIO();
  15. pio->Release();
  16. }
  17. }
  18. return hres;
  19. }
  20. HRESULT UnkTranslateAcceleratorIO(IUnknown *punkThis, MSG* pmsg)
  21. {
  22. HRESULT hres = E_FAIL;
  23. if (punkThis != NULL)
  24. {
  25. IInputObject *pio;
  26. hres = punkThis->QueryInterface(IID_IInputObject, (LPVOID*)&pio);
  27. if (SUCCEEDED(hres))
  28. {
  29. hres = pio->TranslateAcceleratorIO(pmsg);
  30. pio->Release();
  31. }
  32. }
  33. return hres;
  34. }
  35. HRESULT UnkUIActivateIO(IUnknown *punkThis, BOOL fActivate, LPMSG lpMsg)
  36. {
  37. HRESULT hres = E_FAIL;
  38. if (punkThis != NULL)
  39. {
  40. IInputObject *pio;
  41. hres = punkThis->QueryInterface(IID_IInputObject, (LPVOID*)&pio);
  42. if (SUCCEEDED(hres))
  43. {
  44. hres = pio->UIActivateIO(fActivate, lpMsg);
  45. pio->Release();
  46. }
  47. }
  48. return hres;
  49. }
  50. // IInputObjectSite helpers
  51. HRESULT UnkOnFocusChangeIS(IUnknown *punkThis, IUnknown *punkSrc, BOOL fSetFocus)
  52. {
  53. HRESULT hres = E_FAIL;
  54. if (punkThis != NULL)
  55. {
  56. IInputObjectSite *pis;
  57. hres = punkThis->QueryInterface(IID_IInputObjectSite, (LPVOID*)&pis);
  58. if (SUCCEEDED(hres))
  59. {
  60. hres = pis->OnFocusChangeIS(punkSrc, fSetFocus);
  61. pis->Release();
  62. }
  63. }
  64. return hres;
  65. }
  66. // IObjectWithSite helpers
  67. HRESULT UnkSetSite(IUnknown *punk, IUnknown *punkSite)
  68. {
  69. HRESULT hr = E_FAIL;
  70. IObjectWithSite *pows;
  71. Assert(punk);
  72. if (punk) {
  73. hr = punk->QueryInterface(IID_IObjectWithSite, (void**)&pows);
  74. Assert(SUCCEEDED(hr));
  75. if (SUCCEEDED(hr)) {
  76. hr = pows->SetSite(punkSite);
  77. Assert(SUCCEEDED(hr));
  78. pows->Release();
  79. }
  80. }
  81. return hr;
  82. }