PageRenderTime 135ms CodeModel.GetById 32ms RepoModel.GetById 1ms app.codeStats 0ms

/jedi/jwapi/Win32API/JwaCpl.pas

http://xplib.googlecode.com/
Pascal | 317 lines | 74 code | 51 blank | 192 comment | 0 complexity | e53bdb2af5be059a1e698b91b83e976a MD5 | raw file
Possible License(s): LGPL-2.1
  1. {******************************************************************************}
  2. { }
  3. { Control Panel Applets Interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: cpl.h, released June 2000. The original Pascal }
  9. { code is: Cpl.pas, released December 2000. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
  11. { }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
  13. { Marcel van Brakel. All Rights Reserved. }
  14. { }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  16. { }
  17. { You may retrieve the latest version of this file at the Project JEDI }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. // $Id: JwaCpl.pas,v 1.10 2007/09/06 14:57:11 marquardt Exp $
  43. {$IFNDEF JWA_OMIT_SECTIONS}
  44. unit JwaCpl;
  45. {$WEAKPACKAGEUNIT}
  46. {$ENDIF JWA_OMIT_SECTIONS}
  47. {$HPPEMIT ''}
  48. {$HPPEMIT '#include "cpl.h"'}
  49. {$HPPEMIT ''}
  50. {$IFNDEF JWA_OMIT_SECTIONS}
  51. {$I ..\Includes\JediAPILib.inc}
  52. interface
  53. uses
  54. JwaWinUser, JwaWinType;
  55. {$ENDIF JWA_OMIT_SECTIONS}
  56. {$IFNDEF JWA_IMPLEMENTATIONSECTION}
  57. //
  58. // General rules for being installed in the Control Panel:
  59. //
  60. // 1) The DLL must export a function named CPlApplet which will handle
  61. // the messages discussed below.
  62. // 2) If the applet needs to save information in CONTROL.INI minimize
  63. // clutter by using the application name [MMCPL.appletname].
  64. // 2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
  65. // the following form:
  66. // ...
  67. // [MMCPL]
  68. // uniqueName=c:\mydir\myapplet.dll
  69. // ...
  70. //
  71. //
  72. // The order applet DLL's are loaded by CONTROL.EXE is not guaranteed.
  73. // Control panels may be sorted for display, etc.
  74. //
  75. //
  76. // #include <pshpack1.h> // Assume byte packing throughout
  77. //
  78. // CONTROL.EXE will answer this message and launch an applet
  79. //
  80. // WM_CPL_LAUNCH
  81. //
  82. // wParam - window handle of calling app
  83. // lParam - LPTSTR of name of applet to launch
  84. //
  85. // WM_CPL_LAUNCHED
  86. //
  87. // wParam - TRUE/FALSE if applet was launched
  88. // lParam - NULL
  89. //
  90. // CONTROL.EXE will post this message to the caller when the applet returns
  91. // (ie., when wParam is a valid window handle)
  92. //
  93. //
  94. {$IFNDEF JWA_INCLUDEMODE}
  95. const
  96. WM_CPL_LAUNCH = WM_USER + 1000;
  97. {$EXTERNALSYM WM_CPL_LAUNCH}
  98. WM_CPL_LAUNCHED = WM_USER + 1001;
  99. {$EXTERNALSYM WM_CPL_LAUNCHED}
  100. type
  101. // A function prototype for CPlApplet()
  102. APPLET_PROC = function(hwndCpl: HWND; msg: UINT;
  103. lParam1, lParam2: LPARAM): LONG; stdcall;
  104. {$EXTERNALSYM APPLET_PROC}
  105. TCPLApplet = APPLET_PROC;
  106. // The data structure CPlApplet() must fill in.
  107. LPCPLINFO = ^CPLINFO;
  108. {$EXTERNALSYM LPCPLINFO}
  109. tagCPLINFO = packed record
  110. idIcon: Integer; // icon resource id, provided by CPlApplet()
  111. idName: Integer; // name string res. id, provided by CPlApplet()
  112. idInfo: Integer; // info string res. id, provided by CPlApplet()
  113. lData: LONG_PTR; // user defined data
  114. end;
  115. {$EXTERNALSYM tagCPLINFO}
  116. CPLINFO = tagCPLINFO;
  117. {$EXTERNALSYM CPLINFO}
  118. TCplInfo = CPLINFO;
  119. PCplInfo = LPCPLINFO;
  120. LPNEWCPLINFOA = ^NEWCPLINFOA;
  121. {$EXTERNALSYM LPNEWCPLINFOA}
  122. tagNEWCPLINFOA = packed record
  123. dwSize: DWORD; // similar to the commdlg
  124. dwFlags: DWORD;
  125. dwHelpContext: DWORD; // help context to use
  126. lData: LONG_PTR; // user defined data
  127. hIcon: HICON; // icon to use, this is owned by CONTROL.EXE (may be deleted)
  128. szName: array [0..31] of AnsiChar; // short name
  129. szInfo: array [0..63] of AnsiChar; // long name (status line)
  130. szHelpFile: array [0..127] of AnsiChar; // path to help file to use
  131. end;
  132. {$EXTERNALSYM tagNEWCPLINFOA}
  133. NEWCPLINFOA = tagNEWCPLINFOA;
  134. {$EXTERNALSYM NEWCPLINFOA}
  135. TNewCplInfoA = NEWCPLINFOA;
  136. PNewCplInfoA = LPNEWCPLINFOA;
  137. LPNEWCPLINFOW = ^NEWCPLINFOW;
  138. {$EXTERNALSYM LPNEWCPLINFOW}
  139. tagNEWCPLINFOW = packed record
  140. dwSize: DWORD; // similar to the commdlg
  141. dwFlags: DWORD;
  142. dwHelpContext: DWORD; // help context to use
  143. lData: LONG_PTR; // user defined data
  144. hIcon: HICON; // icon to use, this is owned by CONTROL.EXE (may be deleted)
  145. szName: array [0..31] of WCHAR; // short name
  146. szInfo: array [0..63] of WCHAR; // long name (status line)
  147. szHelpFile: array [0..127] of WCHAR; // path to help file to use
  148. end;
  149. {$EXTERNALSYM tagNEWCPLINFOW}
  150. NEWCPLINFOW = tagNEWCPLINFOW;
  151. {$EXTERNALSYM NEWCPLINFOW}
  152. TNewCplInfoW = NEWCPLINFOW;
  153. PNewCplInfoW = LPNEWCPLINFOW;
  154. {$IFDEF UNICODE}
  155. NEWCPLINFO = NEWCPLINFOW;
  156. {$EXTERNALSYM NEWCPLINFO}
  157. LPNEWCPLINFO = LPNEWCPLINFOW;
  158. {$EXTERNALSYM LPNEWCPLINFO}
  159. TNewCplInfo = TNewCplInfoW;
  160. PNewCplInfo = PNewCplInfoW;
  161. {$ELSE}
  162. NEWCPLINFO = NEWCPLINFOA;
  163. {$EXTERNALSYM NEWCPLINFO}
  164. LPNEWCPLINFO = LPNEWCPLINFOA;
  165. {$EXTERNALSYM LPNEWCPLINFO}
  166. TNewCplInfo = TNewCplInfoA;
  167. PNewCplInfo = PNewCplInfoA;
  168. {$ENDIF UNICODE}
  169. const
  170. CPL_DYNAMIC_RES = 0;
  171. {$EXTERNALSYM CPL_DYNAMIC_RES}
  172. // This constant may be used in place of real resource IDs for the idIcon,
  173. // idName or idInfo members of the CPLINFO structure. Normally, the system
  174. // uses these values to extract copies of the resources and store them in a
  175. // cache. Once the resource information is in the cache, the system does not
  176. // need to load a CPL unless the user actually tries to use it.
  177. // CPL_DYNAMIC_RES tells the system not to cache the resource, but instead to
  178. // load the CPL every time it needs to display information about an item. This
  179. // allows a CPL to dynamically decide what information will be displayed, but
  180. // is SIGNIFICANTLY SLOWER than displaying information from a cache.
  181. // Typically, CPL_DYNAMIC_RES is used when a control panel must inspect the
  182. // runtime status of some device in order to provide text or icons to display.
  183. // The messages CPlApplet() must handle:
  184. CPL_INIT = 1;
  185. {$EXTERNALSYM CPL_INIT}
  186. // This message is sent to indicate CPlApplet() was found.
  187. // lParam1 and lParam2 are not defined.
  188. // Return TRUE or FALSE indicating whether the control panel should proceed.
  189. CPL_GETCOUNT = 2;
  190. {$EXTERNALSYM CPL_GETCOUNT}
  191. // This message is sent to determine the number of applets to be displayed.
  192. // lParam1 and lParam2 are not defined.
  193. // Return the number of applets you wish to display in the control
  194. // panel window.
  195. CPL_INQUIRE = 3;
  196. {$EXTERNALSYM CPL_INQUIRE}
  197. // This message is sent for information about each applet.
  198. // A CPL SHOULD HANDLE BOTH THE CPL_INQUIRE AND CPL_NEWINQUIRE MESSAGES.
  199. // The developer must not make any assumptions about the order or dependance
  200. // of CPL inquiries.
  201. // lParam1 is the applet number to register, a value from 0 to
  202. // (CPL_GETCOUNT - 1). lParam2 is a far ptr to a CPLINFO structure.
  203. // Fill in CPLINFO's idIcon, idName, idInfo and lData fields with
  204. // the resource id for an icon to display, name and description string ids,
  205. // and a long data item associated with applet #lParam1. This information
  206. // may be cached by the caller at runtime and/or across sessions.
  207. // To prevent caching, see CPL_DYNAMIC_RES, above.
  208. CPL_SELECT = 4;
  209. {$EXTERNALSYM CPL_SELECT}
  210. // The CPL_SELECT message has been deleted.
  211. CPL_DBLCLK = 5;
  212. {$EXTERNALSYM CPL_DBLCLK}
  213. // This message is sent when the applet's icon has been double-clicked
  214. // upon. lParam1 is the applet number which was selected. lParam2 is the
  215. // applet's lData value.
  216. // This message should initiate the applet's dialog box.
  217. CPL_STOP = 6;
  218. {$EXTERNALSYM CPL_STOP}
  219. // This message is sent for each applet when the control panel is exiting.
  220. // lParam1 is the applet number. lParam2 is the applet's lData value.
  221. // Do applet specific cleaning up here.
  222. CPL_EXIT = 7;
  223. {$EXTERNALSYM CPL_EXIT}
  224. // This message is sent just before the control panel calls FreeLibrary.
  225. // lParam1 and lParam2 are not defined.
  226. // Do non-applet specific cleaning up here.
  227. CPL_NEWINQUIRE = 8;
  228. {$EXTERNALSYM CPL_NEWINQUIRE}
  229. // Same as CPL_INQUIRE execpt lParam2 is a pointer to a NEWCPLINFO struct.
  230. // A CPL SHOULD HANDLE BOTH THE CPL_INQUIRE AND CPL_NEWINQUIRE MESSAGES.
  231. // The developer must not make any assumptions about the order or dependance
  232. // of CPL inquiries.
  233. CPL_STARTWPARMSA = 9;
  234. {$EXTERNALSYM CPL_STARTWPARMSA}
  235. CPL_STARTWPARMSW = 10;
  236. {$EXTERNALSYM CPL_STARTWPARMSW}
  237. {$IFDEF UNICODE}
  238. CPL_STARTWPARMS = CPL_STARTWPARMSW;
  239. {$EXTERNALSYM CPL_STARTWPARMS}
  240. {$ELSE}
  241. CPL_STARTWPARMS = CPL_STARTWPARMSA;
  242. {$EXTERNALSYM CPL_STARTWPARMS}
  243. {$ENDIF UNICODE}
  244. // this message parallels CPL_DBLCLK in that the applet should initiate
  245. // its dialog box. where it differs is that this invocation is coming
  246. // out of RUNDLL, and there may be some extra directions for execution.
  247. // lParam1: the applet number.
  248. // lParam2: an LPSTR to any extra directions that might exist.
  249. // returns: TRUE if the message was handled; FALSE if not.
  250. // This message is internal to the Control Panel and MAIN applets.
  251. // It is only sent when an applet is invoked from the Command line
  252. // during system installation.
  253. CPL_SETUP = 200;
  254. {$EXTERNALSYM CPL_SETUP}
  255. {$ENDIF JWA_INCLUDEMODE}
  256. {$ENDIF JWA_IMPLEMENTATIONSECTION}
  257. {$IFNDEF JWA_OMIT_SECTIONS}
  258. implementation
  259. //uses ...
  260. {$ENDIF JWA_OMIT_SECTIONS}
  261. {$IFNDEF JWA_INTERFACESECTION}
  262. //your implementation here
  263. {$ENDIF JWA_INTERFACESECTION}
  264. {$IFNDEF JWA_OMIT_SECTIONS}
  265. end.
  266. {$ENDIF JWA_OMIT_SECTIONS}