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