notify.pp 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2007-2008 Free Pascal development team.
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************
  10. Automatically converted by H2Pas 1.0.0 from notify.h
  11. The following command line parameters were used:
  12. -d
  13. -c
  14. -w
  15. notify.h
  16. }
  17. unit notify;
  18. interface
  19. uses windows;
  20. {$calling cdecl}
  21. const
  22. NOTIFICATION_EVENT_NONE = 0;
  23. NOTIFICATION_EVENT_TIME_CHANGE = 1;
  24. NOTIFICATION_EVENT_SYNC_END = 2;
  25. NOTIFICATION_EVENT_ON_AC_POWER = 3;
  26. NOTIFICATION_EVENT_OFF_AC_POWER = 4;
  27. NOTIFICATION_EVENT_NET_CONNECT = 5;
  28. NOTIFICATION_EVENT_NET_DISCONNECT = 6;
  29. NOTIFICATION_EVENT_DEVICE_CHANGE = 7;
  30. NOTIFICATION_EVENT_IR_DISCOVERED = 8;
  31. NOTIFICATION_EVENT_RS232_DETECTED = 9;
  32. NOTIFICATION_EVENT_RESTORE_END = 10;
  33. NOTIFICATION_EVENT_WAKEUP = 11;
  34. NOTIFICATION_EVENT_TZ_CHANGE = 12;
  35. NOTIFICATION_EVENT_MACHINE_NAME_CHANGE = 13;
  36. NOTIFICATION_EVENT_LAST = NOTIFICATION_EVENT_MACHINE_NAME_CHANGE;
  37. {
  38. * String passed on the command line when an app is run as the result
  39. * of a call to CeRunAppAtTime().
  40. }
  41. APP_RUN_AT_TIME = 'AppRunAtTime';
  42. {
  43. * Prefix of the command line when the user requests to run the application
  44. * that "owns" a notification. It is followed by a space, and the
  45. * stringized version of the notification handle.
  46. }
  47. APP_RUN_TO_HANDLE_NOTIFICATION = 'AppRunToHandleNotification';
  48. {
  49. * Strings passed on the command line when an event occurs that the
  50. * app has requested via CeRunAppAtEvent. Note that some of these
  51. * strings will be used as the command line *prefix*, since the rest
  52. * of the command line will be used as a parameter.
  53. }
  54. APP_RUN_AFTER_TIME_CHANGE = 'AppRunAfterTimeChange';
  55. APP_RUN_AFTER_SYNC = 'AppRunAfterSync';
  56. APP_RUN_AT_AC_POWER_ON = 'AppRunAtAcPowerOn';
  57. APP_RUN_AT_AC_POWER_OFF = 'AppRunAtAcPowerOff';
  58. APP_RUN_AT_NET_CONNECT = 'AppRunAtNetConnect';
  59. APP_RUN_AT_NET_DISCONNECT = 'AppRunAtNetDisconnect';
  60. APP_RUN_AT_DEVICE_CHANGE = 'AppRunDeviceChange';
  61. APP_RUN_AT_IR_DISCOVERY = 'AppRunAtIrDiscovery';
  62. APP_RUN_AT_RS232_DETECT = 'AppRunAtRs232Detect';
  63. APP_RUN_AFTER_RESTORE = 'AppRunAfterRestore';
  64. APP_RUN_AFTER_WAKEUP = 'AppRunAfterWakeup';
  65. APP_RUN_AFTER_TZ_CHANGE = 'AppRunAfterTzChange';
  66. APP_RUN_AFTER_EXTENDED_EVENT = 'AppRunAfterExtendedEvent';
  67. {
  68. * Strings passed on the end of the command line for the event,
  69. * NOTIFICATION_EVENT_DEVICE_CHANGE. The general form will be
  70. * "/op devicename" for instance "/ADD COM2:"
  71. }
  72. NOTIFY_DEVICE_ADD = '/ADD';
  73. NOTIFY_DEVICE_REMOVE = '/REMOVE';
  74. {
  75. * @struct CE_USER_NOTIFICATION | User Notification Structure
  76. *
  77. * @comm This structure is passed in to <f CeGetUserNotificationPreferences>.
  78. * Initial settings are used to populate the dialog. If the function
  79. * returns TRUE, the returned settings should be saved, and considered when
  80. * calling <f CeSetUserNotification>. Settings for hardware not on the
  81. * current device will be ignored.
  82. *
  83. * It is also used when calling <f CeSetUserNotification>, to describe
  84. * what should happen when the notification time is reached.
  85. }
  86. { PUN_* flags. Flags not valid on a given }
  87. { hardware platform will be ignored. }
  88. PUN_LED = 1; {@flag PUN_LED | LED flag. Set if the LED should be }
  89. { flashed when the notification occurs. }
  90. PUN_VIBRATE = 2; {@flag PUN_VIBRATE | Vibrate flag. Set if the device should }
  91. { be vibrated. }
  92. PUN_DIALOG = 4; {@flag PUN_DIALOG | Dialog flag. Set if a dialog should be }
  93. { displayed (the app must provide title and text }
  94. { when calling <f CeSetUserNotification>). }
  95. PUN_SOUND = 8; {@flag PUN_SOUND | Sound flag. Set if the sound specified }
  96. { in pwszSound should be played. }
  97. PUN_REPEAT = 16; {@flag PUN_REPEAT | Sound repeat flag. Set if the sound }
  98. { specified in pwszSound should be repeated progressively. }
  99. PUN_PRIVATE = 32; {@flag PUN_PRIVATE | Dialog box z-order flag. Set if the }
  100. { notification dialog box should come up behind the password. }
  101. {@field Action Flags. Any combination of the }
  102. {@field Dialog Title. Required if PUN_DIALOG is set, ignored }
  103. { otherwise. Ignored by CeGetUserNotificationPreferences(). }
  104. {@field Dialog Text. Required if PUN_DIALOG is set, ignored }
  105. { otherwise. Ignored by CeGetUserNotificationPreferences(). }
  106. {@field Sound string as supplied to sndPlaySound. }
  107. { CeSetUserNotification() ignores it if PUN_SOUND is not set. }
  108. {@field Max Sound string length. Specifies the }
  109. { maximum length of the string that can be copied }
  110. { into the pwszSound buffer by }
  111. { CeGetUserNotificationPreferences(). }
  112. { Should be at least MAX_PATH * sizeof(TCHAR). }
  113. { Ignored by CeSetUserNotification(). }
  114. { union }
  115. {@field Reserved. Must be NULL or a pointer to }
  116. { platform-defined expansion structure. }
  117. { The first dword of the structure }
  118. { indicates the size of the structure. }
  119. { void *pExpansion; }
  120. { ; }
  121. type
  122. UserNotificationType = record
  123. ActionFlags : DWORD;
  124. pwszDialogTitle : ^TCHAR;
  125. pwszDialogText : ^TCHAR;
  126. pwszSound : ^TCHAR;
  127. nMaxSound : DWORD;
  128. dwReserved : DWORD;
  129. end;
  130. CE_USER_NOTIFICATION = UserNotificationType;
  131. PCE_USER_NOTIFICATION = ^UserNotificationType;
  132. const
  133. CNT_EVENT = 1; {@flag CNT_EVENT | System event notification }
  134. CNT_TIME = 2; {@flag CNT_TIME | Time-based notification }
  135. CNT_PERIOD = 3; {@flag CNT_PERIOD | Time-based notification is active for }
  136. { time period between stStart and stEnd }
  137. CNT_CLASSICTIME = 4; {@flag CNT_CLASSICTIME | equivalent to using (obsolete) }
  138. { CeSetUserNotification function - standard command line is }
  139. { supplied. lpszArguments must be NULL }
  140. {@field dwType Notification type }
  141. {@field dwEvent - type of event if dwType == CNT_EVENT }
  142. {@field lpszApplication - name of application to execute }
  143. {@field lpszArguments - command line (sans app name) }
  144. {@field stStartTime - begin of notification period }
  145. {@field stEndTime - end of notification period }
  146. type
  147. UserNotificationTrigger = record
  148. dwSize : DWORD;
  149. dwType : DWORD;
  150. dwEvent : DWORD;
  151. lpszApplication : ^TCHAR;
  152. lpszArguments : ^TCHAR;
  153. stStartTime : SYSTEMTIME;
  154. stEndTime : SYSTEMTIME;
  155. end;
  156. CE_NOTIFICATION_TRIGGER = UserNotificationTrigger;
  157. PCE_NOTIFICATION_TRIGGER = ^UserNotificationTrigger;
  158. { }
  159. { Application name can be prefixed with the following strings to specify different }
  160. { named objects rather than an application. The action varies depending on the prefix. }
  161. { In case of named event, the event gets signaled. }
  162. { }
  163. const
  164. NAMED_EVENT_PREFIX_TEXT = '\\.\Notifications\NamedEvents\';
  165. NAMED_EVENT_PREFIX_LEN = 30;
  166. CNS_SIGNALLED = 1;
  167. type
  168. UserNotificationInfoHeader = record
  169. hNotification : HANDLE;
  170. dwStatus : DWORD;
  171. pcent : ^CE_NOTIFICATION_TRIGGER;
  172. pceun : ^CE_USER_NOTIFICATION;
  173. end;
  174. CE_NOTIFICATION_INFO_HEADER = UserNotificationInfoHeader;
  175. PCE_NOTIFICATION_INFO_HEADER = ^UserNotificationInfoHeader;
  176. { Declarations of User Notification APIs. }
  177. { C++ extern C conditionnal removed }
  178. {__cplusplus }
  179. { @CESYSGEN IF GWES_NOTIFY }
  180. function CeGetUserNotificationPreferences(hWndParent:HWND; lpNotification:PCE_USER_NOTIFICATION):BOOL;external KernelDLL name 'CeGetUserNotificationPreferences';
  181. function CeSetUserNotificationEx(hNotification:HANDLE; pcnt:PCE_NOTIFICATION_TRIGGER; pceun:PCE_USER_NOTIFICATION):HANDLE;external KernelDLL name 'CeSetUserNotificationEx';
  182. function CeClearUserNotification(hNotification:HANDLE):BOOL;external KernelDLL name 'CeClearUserNotification';
  183. function CeGetUserNotification(hNotification:HANDLE; cBufferSize:DWORD; pcBytesNeeded:LPDWORD; pBuffer:LPBYTE):BOOL;external KernelDLL name 'CeGetUserNotification';
  184. function CeGetUserNotificationHandles(rghNotifications:PHANDLE; cHandles:DWORD; pcHandlesNeeded:LPDWORD):BOOL;external KernelDLL name 'CeGetUserNotificationHandles';
  185. { Obsolete; provided to maintain compatibility only }
  186. function CeSetUserNotification(hNotification:HANDLE; pwszAppName:pTCHAR; var lpTime:SYSTEMTIME; lpUserNotification:PCE_USER_NOTIFICATION):HANDLE;external KernelDLL name 'CeSetUserNotification';
  187. function CeRunAppAtTime(pwszAppName:pTCHAR; var lpTime:SYSTEMTIME):BOOL;external KernelDLL name 'CeRunAppAtTime';
  188. function CeRunAppAtEvent(pwszAppName:pTCHAR; lWhichEvent:LONG):BOOL;external KernelDLL name 'CeRunAppAtEvent';
  189. function CeHandleAppNotifications(pwszAppName:pTCHAR):BOOL;external KernelDLL name 'CeHandleAppNotifications';
  190. implementation
  191. end.