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.

112 lines
2.6 KiB

  1. /**************************** Module Header ********************************\
  2. * Module Name:
  3. *
  4. * Copyright (c) 1985 - 1999, Microsoft Corporation
  5. *
  6. * Scroll bar public APIs
  7. *
  8. * History:
  9. * 08-16-95 FritzS
  10. \***************************************************************************/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. WINUSERAPI
  14. BOOL
  15. WINAPI
  16. EnableScrollBar(
  17. IN HWND hWnd,
  18. IN UINT wSBflags,
  19. IN UINT wArrows)
  20. {
  21. BOOL ret;
  22. BEGIN_USERAPIHOOK()
  23. ret = guah.pfnEnableScrollBar(hWnd, wSBflags, wArrows);
  24. END_USERAPIHOOK()
  25. return ret;
  26. }
  27. BOOL RealEnableScrollBar(
  28. IN HWND hWnd,
  29. IN UINT wSBflags,
  30. IN UINT wArrows)
  31. {
  32. return NtUserEnableScrollBar(hWnd, wSBflags, wArrows);
  33. }
  34. /***************************************************************************\
  35. * SetScrollPos
  36. *
  37. * History:
  38. \***************************************************************************/
  39. FUNCLOG4(LOG_GENERAL, int, DUMMYCALLINGTYPE, SetScrollPos, HWND, hwnd, int, code, int, pos, BOOL, fRedraw)
  40. int SetScrollPos(
  41. HWND hwnd,
  42. int code,
  43. int pos,
  44. BOOL fRedraw)
  45. {
  46. SCROLLINFO si;
  47. si.fMask = SIF_POS | SIF_RETURNOLDPOS;
  48. si.nPos = pos;
  49. si.cbSize = sizeof(SCROLLINFO);
  50. return((int) SetScrollInfo(hwnd, code, &si, fRedraw));
  51. }
  52. /***************************************************************************\
  53. * SetScrollRange
  54. *
  55. * History:
  56. * 16-May-1991 mikeke Changed to return BOOL
  57. \***************************************************************************/
  58. FUNCLOG5(LOG_GENERAL, BOOL, DUMMYCALLINGTYPE, SetScrollRange, HWND, hwnd, int, code, int, posMin, int, posMax, BOOL, fRedraw)
  59. BOOL SetScrollRange(
  60. HWND hwnd,
  61. int code,
  62. int posMin,
  63. int posMax,
  64. BOOL fRedraw)
  65. {
  66. SCROLLINFO si;
  67. /*
  68. * Validate the window handle first, because the further call
  69. * to NtUserSetScrollInfo will return the position of the scrollbar
  70. * and not FALSE if the hwnd is invalid
  71. */
  72. if ( ValidateHwnd((hwnd)) == NULL)
  73. return FALSE;
  74. /*
  75. * Check if the 'Range'(Max - Min) can be represented by an integer;
  76. * If not, it is an error;
  77. * Fix for Bug #1089 -- SANKAR -- 20th Sep, 1989 --.
  78. */
  79. if ((unsigned int)(posMax - posMin) > MAXLONG) {
  80. RIPERR0(ERROR_INVALID_SCROLLBAR_RANGE, RIP_VERBOSE, "");
  81. return FALSE;
  82. }
  83. si.fMask = SIF_RANGE;
  84. si.nMin = posMin;
  85. si.nMax = posMax;
  86. si.cbSize = sizeof(SCROLLINFO);
  87. SetScrollInfo(hwnd, code, &si, fRedraw);
  88. return TRUE;
  89. }