home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / scrnsave.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  9KB  |  193 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * scrnsave.h    Windows NT 3.1 screensaver defines and definitions.           *
  4. *                                                                             *
  5. *               Version 1.0                                                   *
  6. *                                                                             *
  7. *               NOTE: windows.h must be #included first                       *
  8. *                                                                             *
  9. *  Windows NT NOTE:   (Differences from Win 3.1 Screensavers)                 *
  10. *                                                                             *
  11. *               All Screensavers are required to have a Description string    *
  12. *               of no more than 25 chars for display by the Control Panel's   *
  13. *               Desktop applet.  This is string 1 in the resource string      *
  14. *               table of the Windows 32-bit screen saver .SCR (.EXE) file.    *
  15. *                                                                             *
  16. *               Passwords for Windows NT Screen Savers are handled by the     *
  17. *               Winlogon process.  If the registry value:                     *
  18. *                                                                             *
  19. *               HKEY_CURRENT_USER\Control Panel\Desktop\ScreenSaverIsSecure   *
  20. *                                                                             *
  21. *               is nonzero, Winlogon will ask for the User's login password   *
  22. *               before allowing the Screen Saver to exit.  All password data  *
  23. *               and dialogs have been removed from individual Screensavers.   *
  24. *                                                                             *
  25. *                                                                             *
  26. *          Copyright 1992 - 1998 Microsoft Corp.  All rights reserved.     *
  27. *                                                                             *
  28. \*****************************************************************************/
  29.  
  30. #ifndef _INC_SCRNSAVE
  31. #define _INC_SCRNSAVE
  32.  
  33. #include <pshpack1.h>   /* Assume byte packing throughout */
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {            /* Assume C declarations for C++ */
  37. #endif    /* __cplusplus */
  38.  
  39.  
  40. /* MANDATORY string required in .RC file
  41.  * This string should contain a less than 25 char name/description of the
  42.  * screen saver.  This string is what will be seen by the user in the Control
  43.  * Panel's Desktop applet screen saver listbox.
  44.  */
  45.  
  46. #define IDS_DESCRIPTION      1
  47.  
  48. /* Icon resource ID.
  49.  *
  50.  * This should be the first icon used and must have this resource number.
  51.  * This is needed as the first icon in the file will be grabbed
  52.  */
  53. #define ID_APP      100
  54. #define DLG_SCRNSAVECONFIGURE   2003
  55.  
  56. #define idsIsPassword           1000
  57. #define idsIniFile              1001
  58. #define idsScreenSaver          1002
  59. #define idsPassword             1003
  60. #define idsDifferentPW          1004
  61. #define idsChangePW             1005
  62. #define idsBadOldPW             1006
  63. #define idsAppName              1007
  64. #define idsNoHelpMemory         1008
  65. #define idsHelpFile             1009
  66. #define idsDefKeyword           1010
  67.  
  68. /* This function is the Window Procedure for the screen saver.  It is
  69.  * up to the programmer to handle any of the messages that wish to be
  70.  * interpretted.  Any unused messages are then passed back to
  71.  * DefScreenSaverProc if desired which will take default action on any
  72.  * unprocessed message...
  73.  */
  74. #ifdef UNICODE
  75. LRESULT WINAPI ScreenSaverProcW (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  76. #   define  ScreenSaverProc ScreenSaverProcW
  77. #else
  78. LRESULT WINAPI ScreenSaverProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  79. #endif
  80.  
  81. /* This function performs default message processing.  Currently handles
  82.  * the following messages:
  83.  *
  84.  * WM_SYSCOMMAND:   return FALSE if wParam is SC_SCREENSAVE or SC_CLOSE
  85.  *
  86.  * WM_DESTROY:      PostQuitMessage(0)
  87.  *
  88.  * WM_SETCURSOR:    By default, this will set the cursor to a null cursor,
  89.  *                  thereby removing it from the screen.
  90.  *
  91.  * WM_LBUTTONDOWN:
  92.  * WM_MBUTTONDOWN:
  93.  * WM_RBUTTONDOWN:
  94.  * WM_KEYDOWN:
  95.  * WM_KEYUP:
  96.  * WM_MOUSEMOVE:    By default, these will cause the program to terminate.
  97.  *                  Unless the password option is enabled.  In that case
  98.  *                  the DlgGetPassword() dialog box is brought up.
  99.  *
  100.  * WM_NCACTIVATE:
  101.  * WM_ACTIVATEAPP:
  102.  * WM_ACTIVATE:     By default, if the wParam parameter is FALSE (signifying
  103.  *                  that transfer is being taken away from the application),
  104.  *                  then the program will terminate.  Termination is
  105.  *                  accomplished by generating a WM_CLOSE message.  This way,
  106.  *                  if the user sets something up in the WM_CREATE, a
  107.  *                  WM_DESTROY will be generated and it can be destroyed
  108.  *                  properly.
  109.  *                  This message is ignored, however is the password option
  110.  *                  is enabled.
  111.  */
  112. LRESULT WINAPI DefScreenSaverProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
  113.  
  114. /* A function is also needed for configuring the screen saver.  The function
  115.  * should be exactly like it is below and must be exported such that the
  116.  * program can use MAKEPROCINSTANCE on it and call up a dialog box. Further-
  117.  * more, the template used for the dialog must be called
  118.  * ScreenSaverConfigure to allow the main function to access it...
  119.  */
  120. BOOL WINAPI ScreenSaverConfigureDialog (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  121.  
  122. /* To allow the programmer the ability to register child control windows, this
  123.  * function is called prior to the creation of the dialog box.  Any
  124.  * registering that is required should be done here, or return TRUE if none
  125.  * is needed...
  126.  */
  127. BOOL WINAPI RegisterDialogClasses (HANDLE hInst);
  128.  
  129. /* The following functions are called by DefScreenSaverProc and must
  130.  * be exported by all screensavers using this model.
  131.  */
  132.  
  133. /*
  134.  * There are only three other points that should be of notice:
  135.  * 1) The screen saver must have a string declared as 'szAppName' contaning the
  136.  *     name of the screen saver, and it must be declared as a global.
  137.  * 2) The screen saver EXE file should be renamed to a file with a SCR
  138.  *     extension so that the screen saver dialog from the control panel can
  139.  *     find it when is searches for screen savers.
  140.  */
  141. #define WS_GT   (WS_GROUP | WS_TABSTOP)
  142.  
  143. #define MAXFILELEN         13
  144. #define TITLEBARNAMELEN    40
  145. #define APPNAMEBUFFERLEN   40
  146. #define BUFFLEN           255
  147.  
  148. /* The following globals are defined in scrnsave.lib */
  149. extern HINSTANCE hMainInstance;
  150. extern HWND   hMainWindow;
  151. extern BOOL   fChildPreview;
  152. extern TCHAR  szName[TITLEBARNAMELEN];
  153. extern TCHAR  szAppName[APPNAMEBUFFERLEN];
  154. extern TCHAR  szIniFile[MAXFILELEN];
  155. extern TCHAR  szScreenSaver[22];
  156. extern TCHAR  szHelpFile[MAXFILELEN];
  157. extern TCHAR  szNoHelpMemory[BUFFLEN];
  158. extern UINT   MyHelpMessage;
  159.  
  160. /* OPTIONAL - Win95 Only */
  161.  
  162. #define SCRM_VERIFYPW   WM_APP
  163. /*
  164.  * This message is sent to the main screen saver window when password
  165.  * protection is enabled and the user is trying to close the screen saver.  You
  166.  * can process this message and provide your own validation technology.  If you
  167.  * process this message, you should also support the ScreenSaverChangePassword
  168.  * function, described below.  Return zero from this message if the password
  169.  * check failed.  Return nonzero for success.  If you run out of memory or
  170.  * encounter a similar class of error, return non-zero so the user isn't left
  171.  * out in the cold.  The default action is to call the Windows Master
  172.  * Password Router to validate the user's password.
  173.  */
  174.  
  175. void WINAPI ScreenSaverChangePassword( HWND hParent );
  176. /*
  177.  * You supply this if you provide your own authentication.  Windows will call
  178.  * it when the user wants to change the password.  An implementation of this
  179.  * function should present password change UI to the user.
  180.  * You should only supply this function if you also hook the SCRM_VERIFYPW
  181.  * message to validate passwords.
  182.  * The default action is to call the Windows Master Password Router.
  183.  */
  184.  
  185.  
  186. #ifdef __cplusplus
  187. }
  188. #endif    /* __cplusplus */
  189.  
  190. #include <poppack.h>
  191.  
  192. #endif  /* !_INC_SCRNSAVE */
  193.