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