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