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