home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / SCRNSAVE.H < prev    next >
C/C++ Source or Header  |  1997-02-14  |  9KB  |  201 lines

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