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.

100 lines
2.0 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: mmcl.c
  3. *
  4. * Copyright (c) 1985 - 1999, Microsoft Corporation
  5. *
  6. * Multimonitor APIs in the client.
  7. *
  8. * History:
  9. * 29-Mar-1997 adams Created.
  10. \***************************************************************************/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. HMONITOR
  14. MonitorFromPoint(
  15. IN POINT pt,
  16. IN DWORD dwFlags)
  17. {
  18. PMONITOR pMonitor;
  19. if (dwFlags > MONITOR_DEFAULTTONEAREST) {
  20. RIPERR1(ERROR_INVALID_FLAGS,
  21. RIP_WARNING,
  22. "Invalid flags to MonitorFromPoint, %x", dwFlags);
  23. return NULL;
  24. }
  25. pMonitor = _MonitorFromPoint(pt, dwFlags);
  26. try {
  27. return PtoH(pMonitor);
  28. } except(W32ExceptionHandler(TRUE, RIP_WARNING)) {
  29. return NULL;
  30. }
  31. }
  32. HMONITOR
  33. MonitorFromRect(
  34. IN LPCRECT lprc,
  35. IN DWORD dwFlags)
  36. {
  37. PMONITOR pMonitor;
  38. if (dwFlags > MONITOR_DEFAULTTONEAREST) {
  39. RIPERR1(ERROR_INVALID_FLAGS,
  40. RIP_WARNING,
  41. "Invalid flags to MonitorFromRect, %x", dwFlags);
  42. return NULL;
  43. }
  44. pMonitor = _MonitorFromRect(lprc, dwFlags);
  45. try {
  46. return PtoH(pMonitor);
  47. } except(W32ExceptionHandler(TRUE, RIP_WARNING)) {
  48. return NULL;
  49. }
  50. }
  51. HMONITOR
  52. MonitorFromWindow(
  53. IN HWND hwnd,
  54. IN DWORD dwFlags)
  55. {
  56. PMONITOR pMonitor;
  57. PWND pwnd;
  58. if (dwFlags > MONITOR_DEFAULTTONEAREST) {
  59. RIPERR1(ERROR_INVALID_FLAGS,
  60. RIP_WARNING,
  61. "Invalid flags to MonitorFromWindow, %x", dwFlags);
  62. return NULL;
  63. }
  64. if (hwnd) {
  65. pwnd = ValidateHwnd(hwnd);
  66. if (!pwnd) {
  67. return NULL;
  68. }
  69. } else {
  70. pwnd = NULL;
  71. }
  72. pMonitor = _MonitorFromWindow(pwnd, dwFlags);
  73. try {
  74. return PtoH(pMonitor);
  75. } except(W32ExceptionHandler(TRUE, RIP_WARNING)) {
  76. return NULL;
  77. }
  78. }