home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / BLANDMDI.PAK / GLOBALS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  6.9 KB  |  187 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. //           blandmdi.c.
  22.  
  23. LRESULT MsgCommand(HWND, UINT, WPARAM, LPARAM);
  24. LRESULT MsgDestroy(HWND, UINT, WPARAM, LPARAM);
  25. LRESULT MsgMCCommand(HWND, UINT, WPARAM, LPARAM);
  26. LRESULT MsgCreate(HWND, UINT, WPARAM, LPARAM);
  27. LRESULT MsgMCDestroy(HWND, UINT, WPARAM, LPARAM);
  28. LRESULT MsgInitMenu(HWND, UINT, WPARAM, LPARAM);
  29.  
  30.  
  31. //-------------------------------------------------------------------------
  32. // Functions for handling main window commands--ie. functions for
  33. // processing WM_COMMAND messages based on the wParam value.
  34. // The message-dispatching mechanism expects all command-handling
  35. // functions to have the following prototype:
  36. //
  37. //     LRESULT FunctionName(HWND, WORD, WORD, HWND);
  38.  
  39. // **TODO**  Add message-handling function prototypes here.  Be sure to
  40. //           add the function names to the main window command table in
  41. //           blandmdi.c.
  42.  
  43. LRESULT CmdExit(HWND, WORD, WORD, HWND);
  44. LRESULT CmdAbout(HWND, WORD, WORD, HWND);
  45.  
  46. //
  47. // File Commands
  48. //
  49.  
  50. LRESULT CmdFileNew(HWND, WORD, WORD, HWND);
  51. LRESULT CmdFileOpen(HWND, WORD, WORD, HWND);
  52. LRESULT CmdFileSave(HWND, WORD, WORD, HWND);
  53. LRESULT CmdFileSaveAs(HWND, WORD, WORD, HWND);
  54. LRESULT CmdFilePrint(HWND, WORD, WORD, HWND);
  55. LRESULT CmdFilePrintSU(HWND, WORD, WORD, HWND);
  56. LRESULT CmdFileClose(HWND, WORD, WORD, HWND);
  57.  
  58. //
  59. // Window Commands
  60. //
  61.  
  62. LRESULT CmdWindowTile(HWND, WORD, WORD, HWND);
  63. LRESULT CmdWindowCascade(HWND, WORD, WORD, HWND);
  64. LRESULT CmdWindowIcons(HWND, WORD, WORD, HWND);
  65. LRESULT CmdWindowCloseAll(HWND, WORD, WORD, HWND);
  66.  
  67.  
  68.  
  69. //-------------------------------------------------------------------------
  70. // Global function prototypes.
  71.  
  72. // **TODO**  Add global function prototypes here.
  73.  
  74. BOOL InitApplication(HINSTANCE);
  75. BOOL InitInstance(HINSTANCE, int);
  76. BOOL CenterWindow(HWND, HWND);
  77. BOOL InitMDIChild(HINSTANCE);
  78. LRESULT CALLBACK MDIChildWndProc(HWND, UINT, WPARAM, LPARAM);
  79.  
  80.  
  81.     // Callback functions.  These are called by Windows.
  82.  
  83. // **TODO**  Add new callback function prototypes here.  Win16 compiles
  84. //           require the __export keyword to generate proper prolog
  85. //           and epilog code for exported functions.
  86.  
  87. #ifdef WIN16
  88.  
  89. LRESULT CALLBACK __export WndProc(HWND, UINT, WPARAM, LPARAM);
  90.  
  91. #else
  92.  
  93. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  94.  
  95. #endif
  96.  
  97.  
  98. //-------------------------------------------------------------------------
  99. // Global variable declarations.
  100.  
  101. extern HINSTANCE hInst;          // The current instance handle
  102. extern char      szAppName[];    // The name of this application
  103. extern char      szTitle[];      // The title bar text
  104.  
  105. // **TODO**  For NON-MDI applications, uncomment line 1 below and comment
  106. //           line 2.  For MDI applications, uncomment line 2 below, comment
  107. //           line 1, and then define hwndMDIClient as a global variable in
  108. //           INIT.C
  109. //#define hwndMDIClient NULL     /* (1) Stub for NON-MDI applications. */
  110. extern HWND hwndMDIClient;       /* (2) For MDI applications.          */
  111.  
  112. // **BLANDMDI** MDI Frame and Client windows must be accessable to many modules.
  113. extern HWND hwndFrame;           // The MDI Frame window
  114. extern UINT cUntitled;
  115. extern UINT cOpen;
  116.  
  117.  
  118.  
  119. //-------------------------------------------------------------------------
  120. // Message and command dispatch infrastructure.  The following type
  121. // definitions and functions are used by the message and command dispatching
  122. // mechanism and do not need to be changed.
  123.  
  124.     // Function pointer prototype for message handling functions.
  125. typedef LRESULT (*PFNMSG)(HWND,UINT,WPARAM,LPARAM);
  126.  
  127.     // Function pointer prototype for command handling functions.
  128. typedef LRESULT (*PFNCMD)(HWND,WORD,WORD,HWND);
  129.  
  130.     // Enumerated type used to determine which default window procedure
  131.     // should be called by the message- and command-dispatching mechanism
  132.     // if a message or command is not handled explicitly.
  133. typedef enum
  134. {
  135.    edwpNone,            // Do not call any default procedure.
  136.    edwpWindow,          // Call DefWindowProc.
  137.    edwpDialog,          // Call DefDlgProc (This should be used only for
  138.                         // custom dialogs - standard dialog use edwpNone).
  139.    edwpMDIChild,        // Call DefMDIChildProc.
  140.    edwpMDIFrame         // Call DefFrameProc.
  141. } EDWP;                // Enumeration for Default Window Procedures
  142.  
  143.     // This structure maps messages to message handling functions.
  144. typedef struct _MSD
  145. {
  146.     UINT   uMessage;
  147.     PFNMSG pfnmsg;
  148. } MSD;                 // MeSsage Dispatch structure
  149.  
  150.     // This structure contains all of the information that a window
  151.     // procedure passes to DispMessage in order to define the message
  152.     // dispatching behavior for the window.
  153. typedef struct _MSDI
  154. {
  155.     int  cmsd;          // Number of message dispatch structs in rgmsd
  156.     MSD *rgmsd;         // Table of message dispatch structures
  157.     EDWP edwp;          // Type of default window handler needed.
  158. } MSDI, FAR *LPMSDI;    // MeSsage Dipatch Information
  159.  
  160.     // This structure maps command IDs to command handling functions.
  161. typedef struct _CMD
  162. {
  163.     WORD   wCommand;
  164.     PFNCMD pfncmd;
  165. } CMD;                  // CoMmand Dispatch structure
  166.  
  167.     // This structure contains all of the information that a command
  168.     // message procedure passes to DispCommand in order to define the
  169.     // command dispatching behavior for the window.
  170. typedef struct _CMDI
  171. {
  172.     int  ccmd;          // Number of command dispatch structs in rgcmd
  173.     CMD *rgcmd;         // Table of command dispatch structures
  174.     EDWP edwp;          // Type of default window handler needed.
  175. } CMDI, FAR *LPCMDI;    // CoMmand Dispatch Information
  176.  
  177.     // Message and command dispatching functions.  They look up messages
  178.     // and commands in the dispatch tables and call the appropriate handler
  179.     // function.
  180. LRESULT DispMessage(LPMSDI, HWND, UINT, WPARAM, LPARAM);
  181. LRESULT DispCommand(LPCMDI, HWND, WPARAM, LPARAM);
  182.  
  183.     // Message dispatch information for the main window
  184. extern MSDI msdiMain;
  185.     // Command dispatch information for the main window
  186. extern CMDI cmdiMain;
  187.