Annotation of mstools/samples/sdktools/windiff/gutils.h, revision 1.1.1.1

1.1       root        1: 
                      2: /******************************************************************************\
                      3: *       This is a part of the Microsoft Source Code Samples. 
                      4: *       Copyright (C) 1993 Microsoft Corporation.
                      5: *       All rights reserved. 
                      6: *       This source code is only intended as a supplement to 
                      7: *       Microsoft Development Tools and/or WinHelp documentation.
                      8: *       See these sources for detailed information regarding the 
                      9: *       Microsoft samples programs.
                     10: \******************************************************************************/
                     11: 
                     12: /*
                     13:  * GUTILS.H
                     14:  */
                     15: 
                     16: /* win32 msg crackers */
                     17: #define GET_WM_COMMAND_ID(w, l) (LOWORD(w))
                     18: #define GET_WM_COMMAND_CMD(w, l) (HIWORD(w))
                     19: #define GET_WM_COMMAND_HWND(w, l) (l)
                     20: #define GET_SCROLL_OPCODE(w, l)     (LOWORD(w))
                     21: #define GET_SCROLL_POS(w, l)        (HIWORD(w))
                     22: 
                     23: /* ------- memory allocator ------------------------------------------*/
                     24: HANDLE APIENTRY gmem_init(void);
                     25: LPSTR APIENTRY gmem_get(HANDLE hHeap, int len);
                     26: void APIENTRY gmem_free(HANDLE hHeap, LPSTR ptr, int len);
                     27: void APIENTRY gmem_freeall(HANDLE hHeap);
                     28: 
                     29: 
                     30: /* --------- date conversion functions    -----------------------*/
                     31: void APIENTRY gdate_daytodmy(LONG days,
                     32:         int FAR* yrp, int FAR* monthp, int FAR* dayp);
                     33: LONG APIENTRY gdate_dmytoday(int yr, int month, int day);
                     34: int APIENTRY gdate_monthdays(int month, int year);
                     35: int APIENTRY gdate_weekday(long daynr);
                     36: 
                     37: 
                     38: /* --- status line window class ---------------------------------- */
                     39: /* The status line is a bar across the top or bottom of the window.
                     40:  * It can hold a number of fields which can be either static text
                     41:  * or buttons.  The so called "static" text can be changed at any time.
                     42:  * The fields can be left or right aligned (default is RIGHT).
                     43:  * If the text is marked as VAR then the screen real estate allocated
                     44:  * for it will be adjusted whenever the text changes.  VAR fields
                     45:  * can be given minimum or maximum sizes (but not both).
                     46:  *
                     47:  * STATIC text fields can be drawn as raised or lowered rectangles (using
                     48:  * shades of grey), or (default) without a border. BUTTON fields will
                     49:  * always be drawn as raised rectangles, and will lower when pressed.
                     50:  *
                     51:  * Button fields will send WM_COMMAND messages when clicked including the
                     52:  * field id and the WM_LBUTTONUP notification code. Note that that this
                     53:  * is not a full implementation of the button class, and no other messages
                     54:  * will be sent. In general, none of the fields of a status bar are
                     55:  * implemented as separate windows, so GetDlgItem() and similar calls will not
                     56:  * work. Buttons only respond to mouse down events, and there is no handling
                     57:  * of the focus or of keyboard events.
                     58:  *
                     59:  * To use:
                     60:  *    call StatusAlloc giving the number of items you are going to add to the
                     61:  *    status bar. This returns a handle to use in subsequent calls.
                     62:  *
                     63:  *    Then call StatusAddItem to define each item in turn.
                     64:  *    Buttons are placed in order of definition along the bar starting from
                     65:  *    the left (SF_LEFT) and from the right (SF_RIGHT) until the two
                     66:  *    sides meet.
                     67:  *
                     68:  *    Call StatusHeight to find the expected height of this status bar, and
                     69:  *    set its position within the parent window, then call StatusCreate to
                     70:  *    create the window.
                     71:  *
                     72:  * Having created the window, send SM_SETTEXT messages to set the new
                     73:  * text of a field (static or button), or SM_NEW with a handle (obtained from
                     74:  * StatusAlloc) to change the contents of the status line.
                     75:  */
                     76: 
                     77: /* values for type argument to StatusAddItem */
                     78: #define SF_BUTTON       1
                     79: #define SF_STATIC       2
                     80: 
                     81: /* bits in flags argument to StatusAddItem */
                     82: #define SF_RAISE        1       /* paint static as raised 3D rectangle */
                     83: #define SF_LOWER        2       /* paint static as lowered 3D rectangle */
                     84: #define SF_LEFT         4       /* align field on left of status bar */
                     85: #define SF_RIGHT        8       /* align field on right (DEFAULT) */
                     86: #define SF_VAR          0x10    /* size of field depends on actual text extent*/
                     87: #define SF_SZMAX        0x20    /* (with SF_VAR): width argument is maximum */
                     88: #define SF_SZMIN        0x40    /* (with SF_VAR) width arg is minimum size */
                     89: 
                     90: HWND APIENTRY StatusCreate(HANDLE hInst, HWND hParent, int id,
                     91:                 LPRECT rcp, HANDLE hmem);
                     92: int APIENTRY StatusHeight(HANDLE hmem);
                     93: HANDLE APIENTRY StatusAlloc(int nitems);
                     94: BOOL APIENTRY StatusAddItem(HANDLE hmem, int itemnr, int type, int flags,
                     95:         int id, int width, LPSTR text);
                     96: 
                     97: /* send these window messages to the class */
                     98: 
                     99: #define SM_NEW          (WM_USER+1)     /* wParam handle for new status line */
                    100: #define SM_SETTEXT      (WM_USER+2)     /* wparam: item id, lparam new label*/
                    101: 
                    102: void APIENTRY gbit_init(DWORD FAR * map, long nblks);
                    103: BOOL APIENTRY gbit_alloc(DWORD FAR * map, long blknr, long nblks);
                    104: BOOL APIENTRY gbit_free(DWORD FAR * map, long blknr, long nblks);
                    105: long APIENTRY gbit_findfree(DWORD FAR* map, long nblks,
                    106:                 long mapsize, long FAR * blknr);
                    107: 
                    108: 
                    109: /* ----- buffered line input ----------------------------------*/
                    110:  /* handle to a file buffer */
                    111: typedef struct filebuffer * FILEBUFFER;
                    112: 
                    113: FILEBUFFER APIENTRY readfile_new(int fh);
                    114: LPSTR APIENTRY readfile_next(FILEBUFFER fb, int FAR * plen);
                    115: void APIENTRY readfile_delete(FILEBUFFER fb);
                    116: 
                    117: 
                    118: /* ------ hashing  ------------------------------------------- */
                    119: DWORD APIENTRY hash_string(LPSTR string, BOOL bIgnoreBlanks);
                    120: BOOL APIENTRY utils_isblank(LPSTR string);
                    121: int APIENTRY
                    122: utils_CompPath(LPSTR left, LPSTR right);
                    123: 
                    124: /* --- simple input ------------------------------------------------------*/
                    125: int APIENTRY StringInput(LPSTR result, int resultsize, LPSTR prompt,
                    126:                          LPSTR caption, LPSTR def_input);
                    127: 
                    128: 
                    129: 
                    130: 

unix.superglobalmegacorp.com

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