home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / MINIHELP.PAK / GLOBALS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  6.4 KB  |  167 lines

  1. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright (C) 1993-1995  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. // PURPOSE:
  9. //    Contains declarations for all globally scoped names in the program.
  10. //
  11.  
  12. //-------------------------------------------------------------------------
  13. // Product identifier string defines
  14.  
  15. //  **TODO** Change these strings to the name of your application.
  16.  
  17. #define APPNAME       MiniHelp
  18. #define ICONFILE      MiniHelp.ICO
  19. #define SZAPPNAME     "MiniHelp"
  20. #define SZDESCRIPTION "MiniHelp Example Application"
  21. #define SZABOUT       "About MiniHelp"
  22. #define SZVERSION     "Version 4.0"
  23.  
  24.  
  25. //-------------------------------------------------------------------------
  26. // Functions for handling main window messages.  The message-dispatching
  27. // mechanism expects all message-handling functions to have the following
  28. // prototype:
  29. //
  30. //     LRESULT FunctionName(HWND, UINT, WPARAM, LPARAM);
  31.  
  32. // **TODO**  Add message-handling function prototypes here.  Be sure to
  33. //           add the function names to the main window message table in
  34. //           minihelp.c.
  35.  
  36. LRESULT MsgCommand(HWND, UINT, WPARAM, LPARAM);
  37. LRESULT MsgDestroy(HWND, UINT, WPARAM, LPARAM);
  38.  
  39.  
  40. //-------------------------------------------------------------------------
  41. // Functions for handling main window commands--ie. functions for
  42. // processing WM_COMMAND messages based on the wParam value.
  43. // The message-dispatching mechanism expects all command-handling
  44. // functions to have the following prototype:
  45. //
  46. //     LRESULT FunctionName(HWND, WORD, WORD, HWND);
  47.  
  48. // **TODO**  Add message-handling function prototypes here.  Be sure to
  49. //           add the function names to the main window command table in
  50. //           minihelp.c.
  51.  
  52. LRESULT CmdExit(HWND, WORD, WORD, HWND);
  53. LRESULT CmdAbout(HWND, WORD, WORD, HWND);
  54. LRESULT CmdHelpContents(HWND, WORD, WORD, HWND);
  55. LRESULT CmdHelpSearch(HWND, WORD, WORD, HWND);
  56. LRESULT CmdHelpHelp(HWND, WORD, WORD, HWND);
  57.  
  58. //-------------------------------------------------------------------------
  59. // Global function prototypes.
  60.  
  61. // **TODO**  Add global function prototypes here.
  62.  
  63. BOOL InitApplication(HINSTANCE);
  64. BOOL InitInstance(HINSTANCE, int);
  65. BOOL CenterWindow(HWND, HWND);
  66.  
  67.     // Callback functions.  These are called by Windows.
  68.  
  69. // **TODO**  Add new callback function prototypes here.  Win16 compiles
  70. //           require the __export keyword to generate proper prolog
  71. //           and epilog code for exported functions.
  72.  
  73. #ifdef WIN16
  74.  
  75. LRESULT CALLBACK __export WndProc(HWND, UINT, WPARAM, LPARAM);
  76.  
  77. #else
  78.  
  79. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  80.  
  81. #endif
  82.  
  83.  
  84. //-------------------------------------------------------------------------
  85. // Global variable declarations.
  86.  
  87. extern HINSTANCE hInst;          // The current instance handle
  88. extern char      szAppName[];    // The name of this application
  89. extern char      szTitle[];      // The title bar text
  90.  
  91. // **TODO**  For NON-MDI applications, uncomment line 1 below and comment
  92. //           line 2.  For MDI applications, uncomment line 2 below, comment
  93. //           line 1, and then define hwndMDIClient as a global variable in
  94. //           INIT.C
  95. #define hwndMDIClient NULL        /* (1) Stub for NON-MDI applications. */
  96. // extern HWND hwndMDIClient;     /* (2) For MDI applications.          */
  97.  
  98.  
  99. //-------------------------------------------------------------------------
  100. // Message and command dispatch infrastructure.  The following type
  101. // definitions and functions are used by the message and command dispatching
  102. // mechanism and do not need to be changed.
  103.  
  104.     // Function pointer prototype for message handling functions.
  105. typedef LRESULT (*PFNMSG)(HWND,UINT,WPARAM,LPARAM);
  106.  
  107.     // Function pointer prototype for command handling functions.
  108. typedef LRESULT (*PFNCMD)(HWND,WORD,WORD,HWND);
  109.  
  110.     // Enumerated type used to determine which default window procedure
  111.     // should be called by the message- and command-dispatching mechanism
  112.     // if a message or command is not handled explicitly.
  113. typedef enum
  114. {
  115.    edwpNone,            // Do not call any default procedure.
  116.    edwpWindow,          // Call DefWindowProc.
  117.    edwpDialog,          // Call DefDlgProc (This should be used only for
  118.                         // custom dialogs - standard dialog use edwpNone).
  119.    edwpMDIChild,        // Call DefMDIChildProc.
  120.    edwpMDIFrame         // Call DefFrameProc.
  121. } EDWP;                 // Enumeration for Default Window Procedures
  122.  
  123.     // This structure maps messages to message handling functions.
  124. typedef struct _MSD
  125. {
  126.     UINT   uMessage;
  127.     PFNMSG pfnmsg;
  128. } MSD;                  // Message Dispatch structure
  129.  
  130.     // This structure contains all of the information that a window
  131.     // procedure passes to DispMessage in order to define the message
  132.     // dispatching behavior for the window.
  133. typedef struct _MSDI
  134. {
  135.     int  cmsd;          // Number of message dispatch structs in rgmsd
  136.     MSD *rgmsd;         // Table of message dispatch structures
  137.     EDWP edwp;          // Type of default window handler needed.
  138. } MSDI, FAR *LPMSDI;    // Message Dipatch Information
  139.  
  140.     // This structure maps command IDs to command handling functions.
  141. typedef struct _CMD
  142. {
  143.     WORD   wCommand;
  144.     PFNCMD pfncmd;
  145. } CMD;                  // CoMmand Dispatch structure
  146.  
  147.     // This structure contains all of the information that a command
  148.     // message procedure passes to DispCommand in order to define the
  149.     // command dispatching behavior for the window.
  150. typedef struct _CMDI
  151. {
  152.     int  ccmd;          // Number of command dispatch structs in rgcmd
  153.     CMD *rgcmd;         // Table of command dispatch structures
  154.     EDWP edwp;          // Type of default window handler needed.
  155. } CMDI, FAR *LPCMDI;    // CoMmand Dispatch Information
  156.  
  157.     // Message and command dispatching functions.  They look up messages
  158.     // and commands in the dispatch tables and call the appropriate handler
  159.     // function.
  160. LRESULT DispMessage(LPMSDI, HWND, UINT, WPARAM, LPARAM);
  161. LRESULT DispCommand(LPCMDI, HWND, WPARAM, LPARAM);
  162.  
  163.     // Message dispatch information for the main window
  164. extern MSDI msdiMain;
  165.     // Command dispatch information for the main window
  166. extern CMDI cmdiMain;
  167.