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.

79 lines
2.8 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // TopWin.cpp : Implementation of CTopWin, hidden top level window for handling system broadcast messages
  3. // Copyright (c) Microsoft Corporation 1999-2000.
  4. #include <stdafx.h>
  5. #ifndef TUNING_MODEL_ONLY
  6. #include <vrsegimpl.h>
  7. #include "vidctl.h"
  8. BOOL CTopWin::ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) {
  9. switch(uMsg) {
  10. case WM_TIMER:
  11. //
  12. // Do something to keep the screen saver from coming alive
  13. //
  14. //PostMessage(WM_CHAR,0,0); // didn't work
  15. //
  16. // Query the screen saver timeout value and set said value
  17. // to the value we get. This should have no real effect,
  18. // so I can't think of any possible side effects even if
  19. // this crashes half way through, etc.
  20. //
  21. if(m_pVidCtl){
  22. if(m_pVidCtl->m_State == STATE_PLAY && m_pVidCtl->m_pVideoRenderer){
  23. CComQIPtr<IMSVidVideoRenderer2> sp_VidVid(m_pVidCtl->m_pVideoRenderer);
  24. if(sp_VidVid){
  25. VARIANT_BOOL effects;
  26. HRESULT hr = sp_VidVid->get_SuppressEffects(&effects);
  27. if(SUCCEEDED(hr) && effects == VARIANT_TRUE){
  28. unsigned int TimeOut;
  29. if (SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &TimeOut, 0) == 0){
  30. TRACELM(TRACE_ERROR, "Could not get screen saver timeout");
  31. }
  32. else {
  33. if (SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, TimeOut, 0, 0) == 0){
  34. TRACELM(TRACE_ERROR,"Cannot set screen saver timeout");
  35. }
  36. else{
  37. TRACELM(TRACE_PAINT,"Successfully reset screen saver timeout");
  38. }
  39. }
  40. }
  41. }
  42. }
  43. }
  44. // No break...fall through
  45. case WM_MEDIAEVENT:
  46. case WM_POWERBROADCAST:
  47. case WM_DEVICECHANGE:
  48. case WM_DISPLAYCHANGE:
  49. // WM_QUERYENDSESSION?
  50. // WM_ENDSESSION?
  51. if (m_pVidCtl) {
  52. return m_pVidCtl->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, dwMsgMapID);
  53. }
  54. break;
  55. case WM_USER + WMUSER_INPLACE_ACTIVATE:
  56. if (m_pVidCtl) {
  57. TRACELM(TRACE_PAINT, "CTopWin::ProcessWindowMessage() InPlaceActivate()");
  58. m_pVidCtl->InPlaceActivate(OLEIVERB_INPLACEACTIVATE, NULL);
  59. }
  60. break;
  61. case WM_USER + WMUSER_SITE_RECT_WRONG:
  62. if (m_pVidCtl) {
  63. TRACELM(TRACE_PAINT, "CTopWin::ProcessWindowMessage() OnSizeChange");
  64. m_pVidCtl->OnSizeChange();
  65. }
  66. break;
  67. }
  68. return FALSE;
  69. }
  70. #endif //TUNING_MODEL_ONLY
  71. // end of file - topwin.cpp