home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / LISTCTRL.PAK / GLOBALS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  6.5 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. // Product identifier string defines
  14.  
  15. //  **TODO** Change these strings to the name of your application.
  16.  
  17. #define APPNAME       ListCtrl
  18. #define ICONFILE      WINDOWS.ICO
  19. #define SZAPPNAME     "ListCtrl"
  20. #define SZDESCRIPTION "ListCtrl Example Application"
  21. #define SZABOUT       "About ListCtrl"
  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. //           listctrl.c.
  35.  
  36. LRESULT MsgCreate        (HWND, UINT, WPARAM, LPARAM);
  37. LRESULT MsgCommand       (HWND, UINT, WPARAM, LPARAM);
  38. LRESULT MsgSize          (HWND, UINT, WPARAM, LPARAM);
  39. LRESULT MsgSysColorChange(HWND, UINT, WPARAM, LPARAM);
  40. LRESULT MsgDestroy       (HWND, UINT, WPARAM, LPARAM);
  41.  
  42.  
  43. //-------------------------------------------------------------------------
  44. // Functions for handling main window commands--ie. functions for
  45. // processing WM_COMMAND messages based on the wParam value.
  46. // The message-dispatching mechanism expects all command-handling
  47. // functions to have the following prototype:
  48. //
  49. //     LRESULT FunctionName(HWND, WORD, WORD, HWND);
  50.  
  51. // **TODO**  Add message-handling function prototypes here.  Be sure to
  52. //           add the function names to the main window command table in
  53. //           listctrl.c.
  54.  
  55. LRESULT CmdExit(HWND, WORD, WORD, HWND);
  56. LRESULT CmdAbout(HWND, WORD, WORD, HWND);
  57. LRESULT CmdLargeIcons(HWND, WORD, WORD, HWND);
  58. LRESULT CmdSmallIcons(HWND, WORD, WORD, HWND);
  59. LRESULT CmdList(HWND, WORD, WORD, HWND);
  60. LRESULT CmdDetails(HWND, WORD, WORD, HWND);
  61. LRESULT CmdEditStockInfo(HWND, WORD, WORD, HWND);
  62.  
  63.  
  64. //-------------------------------------------------------------------------
  65. // Global function prototypes.
  66.  
  67. // **TODO**  Add global function prototypes here.
  68.  
  69. BOOL InitApplication(HINSTANCE);
  70. BOOL InitInstance(HINSTANCE, int);
  71. BOOL CenterWindow(HWND, HWND);
  72.  
  73.     // Callback functions.  These are called by Windows.
  74.  
  75. // **TODO**  Add new callback function prototypes here.
  76.  
  77. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  78.  
  79.  
  80. //-------------------------------------------------------------------------
  81. // Global variable declarations.
  82.  
  83. extern HINSTANCE hInst;          // The current instance handle
  84. extern char      szAppName[];    // The name of this application
  85. extern char      szTitle[];      // The title bar text
  86. extern HWND      ghwnd;          // Handle to main window
  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.