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.

99 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 1990-1999 Microsoft Corporation, All Rights Reserved
  3. Module Name:
  4. mmonitor.c
  5. this file contains functions which support Multiple Monitors
  6. ++*/
  7. #include <windows.h>
  8. #include <immdev.h>
  9. #include <imedefs.h>
  10. #ifdef MUL_MONITOR
  11. /**********************************************************************/
  12. /* ImeMonitorWorkAreaFromWindow() */
  13. /**********************************************************************/
  14. RECT PASCAL ImeMonitorWorkAreaFromWindow( HWND hAppWnd)
  15. {
  16. HMONITOR hMonitor;
  17. hMonitor = MonitorFromWindow(hAppWnd, MONITOR_DEFAULTTONEAREST);
  18. if (hMonitor) {
  19. MONITORINFO sMonitorInfo;
  20. sMonitorInfo.cbSize = sizeof(sMonitorInfo);
  21. // init a default value to avoid GetMonitorInfo fails
  22. sMonitorInfo.rcWork = sImeG.rcWorkArea;
  23. GetMonitorInfo(hMonitor, &sMonitorInfo);
  24. return sMonitorInfo.rcWork;
  25. } else
  26. return sImeG.rcWorkArea;
  27. }
  28. /**********************************************************************/
  29. /* ImeMonitorWorkAreaFromPoint() */
  30. /**********************************************************************/
  31. RECT PASCAL ImeMonitorWorkAreaFromPoint(
  32. POINT ptPoint)
  33. {
  34. HMONITOR hMonitor;
  35. hMonitor = MonitorFromPoint(ptPoint, MONITOR_DEFAULTTONEAREST);
  36. if (hMonitor) {
  37. MONITORINFO sMonitorInfo;
  38. sMonitorInfo.cbSize = sizeof(sMonitorInfo);
  39. // init a default value to avoid GetMonitorInfo fails
  40. sMonitorInfo.rcWork = sImeG.rcWorkArea;
  41. GetMonitorInfo(hMonitor, &sMonitorInfo);
  42. return sMonitorInfo.rcWork;
  43. } else
  44. return sImeG.rcWorkArea;
  45. }
  46. /**********************************************************************/
  47. /* ImeMonitorWorkAreaFromRect() */
  48. /**********************************************************************/
  49. RECT PASCAL ImeMonitorWorkAreaFromRect(
  50. LPRECT lprcRect)
  51. {
  52. HMONITOR hMonitor;
  53. hMonitor = MonitorFromRect(lprcRect, MONITOR_DEFAULTTONEAREST);
  54. if (hMonitor) {
  55. MONITORINFO sMonitorInfo;
  56. sMonitorInfo.cbSize = sizeof(sMonitorInfo);
  57. // init a default value to avoid GetMonitorInfo fails
  58. sMonitorInfo.rcWork = sImeG.rcWorkArea;
  59. GetMonitorInfo(hMonitor, &sMonitorInfo);
  60. return sMonitorInfo.rcWork;
  61. } else
  62. return sImeG.rcWorkArea;
  63. }
  64. #endif // MUL_MONITOR