home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / SAMPLES / SHOWGDI / UTIL.H_ / UTIL.H
Encoding:
C/C++ Source or Header  |  1993-02-08  |  2.8 KB  |  80 lines

  1. /****************************************************************************
  2.  Util.h
  3.  
  4.  The Util module handles misc. low-level utilities.
  5.  
  6. ****************************************************************************/
  7.  
  8.  
  9. /****************************************************************************
  10.   Constants
  11. ****************************************************************************/
  12.  
  13. #define MAXINT    32767
  14. #define BIGINT    8192
  15.  
  16.  
  17. /****************************************************************************
  18.    Globals
  19. ****************************************************************************/
  20.  
  21. extern HCURSOR hcurSave;   /* saved cursor before hourglass is shown */
  22.  
  23.  
  24. /****************************************************************************
  25.    Lexical macros
  26. ****************************************************************************/
  27.  
  28. #define WNDPROC   long FAR PASCAL _export 
  29. #define DLGPROC   int FAR PASCAL _export
  30. #define CLASSPROC long (FAR PASCAL *)()
  31.  
  32.  
  33. /****************************************************************************
  34.    Non-functional macros
  35. ****************************************************************************/
  36.  
  37. /* Macro to declare a dialog prog */
  38. #define DlgProcDecl( name )   \
  39.    DLGPROC name##Proc( HWND, unsigned, WORD, DWORD )
  40.  
  41. /* Macro to run a dialog box, with main window as parent, with generated 
  42.    template name and dialog proc */
  43. #define Dlg( name )  \
  44.    RunDlg( #name, MakeProcInstance( (FARPROC) name##Proc, hInst ), hwndMain )
  45.  
  46. /* Macro to run a dialog box, with a given window as parent, with generated 
  47.    template name and dialog proc */
  48. #define NestedDlg( parent, name )  \
  49.    RunDlg( #name, MakeProcInstance( (FARPROC) name##Proc, hInst ), parent )
  50.  
  51.  
  52. /****************************************************************************
  53.    Functional macros
  54. ****************************************************************************/
  55.  
  56. #define Width( r )   ((r).right - (r).left)
  57. #define Height( r )  ((r).bottom - (r).top)
  58.  
  59. /* Macro to enable or disable a menu item */
  60. #define EnableMenuCmd( hMenu, item, on )   \
  61.    EnableMenuItem( hMenu, item, (on) ? MF_ENABLED : (MF_DISABLED | MF_GRAYED) );
  62.  
  63. /* Macro to check a menu item on or off */
  64. #define CheckMenuCmd( hMenu, item, on )   \
  65.    CheckMenuItem( hMenu, item, (on) ? MF_CHECKED : MF_UNCHECKED );
  66.  
  67. /* Macros to display/remove hourglass cursor for lengthy operations */
  68. #define StartWait() hcurSave = SetCursor( LoadCursor( NULL, IDC_WAIT ) )
  69. #define EndWait()   SetCursor( hcurSave )
  70.  
  71.  
  72. /****************************************************************************
  73.    Functions
  74. ****************************************************************************/
  75.  
  76. int ToIntegerPin( long l );
  77. int Min( int x, int y );
  78. int Max( int x, int y );
  79. unsigned long HexToLong( char *s);
  80.