Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
8.3 KiB

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