Annotation of mstools/ole20/samples/bttncur/cursors.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.