home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / FILESYS.PAK / GLOBALS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  5.6 KB  |  143 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. // Functions for handling main window messages.  The message-dispatching
  14. // mechanism expects all message-handling functions to have the following
  15. // prototype:
  16. //
  17. //     LRESULT FunctionName(HWND, UINT, WPARAM, LPARAM);
  18.  
  19. // **TODO**  Add message-handling function prototypes here.  Be sure to
  20. //           add the function names to the main window message table in
  21. //           maintbls.c.
  22.  
  23. LRESULT MsgCommand(HWND, UINT, WPARAM, LPARAM);
  24. LRESULT MsgDestroy(HWND, UINT, WPARAM, LPARAM);
  25.  
  26.  
  27. //-------------------------------------------------------------------------
  28. // Functions for handling main window commands--ie. functions for
  29. // processing WM_COMMAND messages based on the wParam value.
  30. // The message-dispatching mechanism expects all command-handling
  31. // functions to have the following prototype:
  32. //
  33. //     LRESULT FunctionName(HWND, WORD, WORD, HWND);
  34.  
  35. // **TODO**  Add message-handling function prototypes here.  Be sure to
  36. //           add the function names to the main window command table in
  37. //           maintbls.c.
  38.  
  39. LRESULT CmdExit(HWND, WORD, WORD, HWND);
  40. LRESULT CmdAbout(HWND, WORD, WORD, HWND);
  41. LRESULT CmdDemo(HWND, WORD, WORD, HWND);
  42.  
  43.  
  44.  
  45. //-------------------------------------------------------------------------
  46. // Global function prototypes.
  47.  
  48. // **TODO**  Add global function prototypes here.
  49.  
  50. BOOL InitApplication(HINSTANCE);
  51. BOOL InitInstance(HINSTANCE, int);
  52. BOOL CenterWindow(HWND, HWND);
  53.  
  54.     // Callback functions.  These are called by Windows.
  55.  
  56. // **TODO**  Add new callback function prototypes here. 
  57.  
  58. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  59.  
  60. //-------------------------------------------------------------------------
  61. // Global variable declarations.
  62.  
  63. extern HINSTANCE hInst;          // The current instance handle
  64. extern char      szAppName[];    // The name of this application
  65. extern char      szTitle[];      // The title bar text
  66.  
  67. // **TODO**  For NON-MDI applications, uncomment line 1 below and comment
  68. //           line 2.  For MDI applications, uncomment line 2 below, comment
  69. //           line 1, and then define hwndMDIClient as a global variable in
  70. //           INIT.C
  71. #define hwndMDIClient NULL        /* (1) Stub for NON-MDI applications. */
  72. // extern HWND hwndMDIClient;     /* (2) For MDI applications.          */
  73.  
  74.  
  75. //-------------------------------------------------------------------------
  76. // Message and command dispatch infrastructure.  The following type
  77. // definitions and functions are used by the message and command dispatching
  78. // mechanism and do not need to be changed.
  79.  
  80.     // Function pointer prototype for message handling functions.
  81. typedef LRESULT (*PFNMSG)(HWND,UINT,WPARAM,LPARAM);
  82.  
  83.     // Function pointer prototype for command handling functions.
  84. typedef LRESULT (*PFNCMD)(HWND,WORD,WORD,HWND);
  85.  
  86.     // Enumerated type used to determine which default window procedure
  87.     // should be called by the message- and command-dispatching mechanism
  88.     // if a message or command is not handled explicitly.
  89. typedef enum
  90. {
  91.    edwpNone,            // Do not call any default procedure.
  92.    edwpWindow,          // Call DefWindowProc.
  93.    edwpDialog,          // Call DefDlgProc (This should be used only for
  94.                         // custom dialogs - standard dialog use edwpNone).
  95.    edwpMDIChild,        // Call DefMDIChildProc.
  96.    edwpMDIFrame         // Call DefFrameProc.
  97. } EDWP;                // Enumeration for Default Window Procedures
  98.  
  99.     // This structure maps messages to message handling functions.
  100. typedef struct _MSD
  101. {
  102.     UINT   uMessage;
  103.     PFNMSG pfnmsg;
  104. } MSD;                 // MeSsage Dispatch structure
  105.  
  106.     // This structure contains all of the information that a window
  107.     // procedure passes to DispMessage in order to define the message
  108.     // dispatching behavior for the window.
  109. typedef struct _MSDI
  110. {
  111.     int  cmsd;          // Number of message dispatch structs in rgmsd
  112.     MSD *rgmsd;         // Table of message dispatch structures
  113.     EDWP edwp;          // Type of default window handler needed.
  114. } MSDI, FAR *LPMSDI;   // MeSsage Dipatch Information
  115.  
  116.     // This structure maps command IDs to command handling functions.
  117. typedef struct _CMD
  118. {
  119.     WORD   wCommand;
  120.     PFNCMD pfncmd;
  121. } CMD;                 // CoMmand Dispatch structure
  122.  
  123.     // This structure contains all of the information that a command
  124.     // message procedure passes to DispCommand in order to define the
  125.     // command dispatching behavior for the window.
  126. typedef struct _CMDI
  127. {
  128.     int  ccmd;          // Number of command dispatch structs in rgcmd
  129.     CMD *rgcmd;         // Table of command dispatch structures
  130.     EDWP edwp;          // Type of default window handler needed.
  131. } CMDI, FAR *LPCMDI;   // CoMmand Dispatch Information
  132.  
  133.     // Message and command dispatching functions.  They look up messages
  134.     // and commands in the dispatch tables and call the appropriate handler
  135.     // function.
  136. LRESULT DispMessage(LPMSDI, HWND, UINT, WPARAM, LPARAM);
  137. LRESULT DispCommand(LPCMDI, HWND, WPARAM, LPARAM);
  138.  
  139.     // Message dispatch information for the main window
  140. extern MSDI msdiMain;
  141.     // Command dispatch information for the main window
  142. extern CMDI cmdiMain;
  143.