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.

150 lines
4.5 KiB

  1. /*
  2. * CURSORS.C
  3. * Buttons & Cursors Version 1.1, Win32 version August 1993
  4. *
  5. * Public functions to retrieve new cursors from the BTTNCUR DLL based
  6. * on ordinal to prevent applications from necessarily calling LoadCursor
  7. * directly on the DLL.
  8. *
  9. * Copyright (c)1992-1993 Microsoft Corporation, All Rights Reserved,
  10. * as applied to redistribution of this source code in source form
  11. * License is granted to use of compiled code in shipped binaries.
  12. */
  13. #ifdef WIN32
  14. #define _INC_OLE
  15. #define __RPC_H__
  16. #endif
  17. #include <windows.h>
  18. #include "bttncur.h"
  19. #include "bttncuri.h"
  20. /*
  21. * The +1 is because MAX is the highest allowable number and MIN is not
  22. * necessarily zero.
  23. */
  24. HCURSOR rgHCursors[IDC_NEWUICURSORMAX-IDC_NEWUICURSORMIN+1];
  25. /*
  26. * CursorsCache
  27. * Internal
  28. *
  29. * Purpose:
  30. * Loads all the cursors available through NewUICursorLoad into
  31. * a global array. This way we can clean up all the cursors without
  32. * placing the burden on the application.
  33. *
  34. * Parameters:
  35. * hInst HANDLE of the DLL instance.
  36. *
  37. * Return Value:
  38. * None. If any of the LoadCursor calls fail, then the corresponding
  39. * array entry is NULL and NewUICursorLoad will fail. Better to fail
  40. * an app getting a cursor than failing to load the app just for that
  41. * reason; and app can attempt to load the cursor on startup if it's
  42. * that important, and fail itself.
  43. */
  44. void CursorsCache(HINSTANCE hInst)
  45. {
  46. UINT i;
  47. for (i=IDC_NEWUICURSORMIN; i<=IDC_NEWUICURSORMAX; i++)
  48. rgHCursors[i-IDC_NEWUICURSORMIN]=LoadCursor(hInst, MAKEINTRESOURCE(i));
  49. return;
  50. }
  51. /*
  52. * CursorsFree
  53. * Internal
  54. *
  55. * Purpose:
  56. * Frees all the cursors previously loaded through CursorsCache.
  57. *
  58. * Parameters:
  59. * None
  60. *
  61. * Return Value:
  62. * None
  63. */
  64. void CursorsFree(void)
  65. {
  66. /*
  67. * Note that since cursors are discardable resources and should
  68. * not be used with DestroyCursor, there's nothing to do here.
  69. * We still provide this API for compatibility and to maintain
  70. * symmetry.
  71. */
  72. return;
  73. }
  74. /*
  75. * UICursorLoad
  76. * Public API
  77. *
  78. * Purpose:
  79. * Loads and returns a handle to one of the new standard UI cursors
  80. * contained in UITOOLS.DLL. The application must not call DestroyCursor
  81. * on this cursor as it is managed by the DLL.
  82. *
  83. * Parameters:
  84. * iCursor UINT index to the cursor to load which must be one
  85. * of the following values:
  86. *
  87. * IDC_RIGHTARROW Right pointing standard arrow
  88. * IDC_CONTEXTHELP Arrow with a ? (context help)
  89. * IDC_MAGNIFY Magnifying glass for zooming
  90. * IDC_NODROP Circle with a slash
  91. * IDC_TABLETOP Small arrow pointing down
  92. *
  93. * IDC_SMALLARROWS Thin four-headed arrow
  94. * IDC_LARGEARROWS Wide four-headed arrow
  95. * IDC_HARROWS Horizontal two-headed arrow
  96. * IDC_VARROWS Vertical two-headed arrow
  97. * IDC_NESWARROWS Two-headed arrow pointing NE<->SW
  98. * IDC_NWSEHARROWS Two-headed arrow pointing NW<->SE
  99. *
  100. * IDC_HSIZEBAR Horizontal two-headed arrow with
  101. * a single vertical bar down the
  102. * middle
  103. *
  104. * IDC_VSIZEBAR Vertical two-headed arrow with a
  105. * single horizontal bar down the
  106. * middle
  107. *
  108. * IDC_HSPLITBAR Horizontal two-headed arrow with
  109. * split double vertical bars down the
  110. * middle
  111. *
  112. * IDC_VSPLITBAR Vertical two-headed arrow with split
  113. * double horizontal bars down the
  114. * middle
  115. *
  116. * Return Value:
  117. * HCURSOR Handle to the loaded cursor if successful, NULL
  118. * if iCursor is out of range or the function could not
  119. * load the cursor.
  120. */
  121. HCURSOR WINAPI UICursorLoad(UINT iCursor)
  122. {
  123. HCURSOR hCur=NULL;
  124. if ((iCursor >= IDC_NEWUICURSORMIN) && (iCursor <= IDC_NEWUICURSORMAX))
  125. hCur=rgHCursors[iCursor-IDC_NEWUICURSORMIN];
  126. return hCur;
  127. }