JwaUxTheme.pas
上传用户:davidchvip
上传日期:2009-07-28
资源大小:1749k
文件大小:67k
源码类别:

Windows编程

开发平台:

Delphi

  1. {******************************************************************************}
  2. {                                                                       }
  3. { Visual Styles (Themes) API 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: uxtheme.h, released June 2001. The original Pascal     }
  9. { code is: UxTheme.pas, released July 2001. The initial developer of the       }
  10. { Pascal code is Marcel van Brakel (brakelm@chello.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 home    }
  18. { page, located at http://delphi-jedi.org or my personal homepage located at   }
  19. { http://members.chello.nl/m.vanbrakel2                                        }
  20. {                }
  21. { The contents of this file are used with permission, subject to the Mozilla   }
  22. { Public License Version 1.1 (the "License"); you may not use this file except }
  23. { in compliance with the License. You may obtain a copy of the License at      }
  24. { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
  25. {                                                                              }
  26. { Software distributed under the License is distributed on an "AS IS" basis,   }
  27. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  28. { the specific language governing rights and limitations under the License.    }
  29. {                                                                              }
  30. { Alternatively, the contents of this file may be used under the terms of the  }
  31. { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
  32. { provisions of the LGPL License are applicable instead of those above.        }
  33. { If you wish to allow use of your version of this file only under the terms   }
  34. { of the LGPL License and not to allow others to use your version of this file }
  35. { under the MPL, indicate your decision by deleting  the provisions above and  }
  36. { replace  them with the notice and other provisions required by the LGPL      }
  37. { License.  If you do not delete the provisions above, a recipient may use     }
  38. { your version of this file under either the MPL or the LGPL License.          }
  39. {                 }
  40. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  41. {                 }
  42. {******************************************************************************}
  43. unit JwaUxTheme;
  44. {$WEAKPACKAGEUNIT}
  45. {$HPPEMIT ''}
  46. {$HPPEMIT '#include "uxtheme.h"'}
  47. {$HPPEMIT ''}
  48. {$I WINDEFINES.INC}
  49. interface
  50. uses
  51.   JwaWinType, JwaWinGDI;
  52. type
  53.   HIMAGELIST = HANDLE; // TODO TEMPORARY
  54. type
  55.   HTHEME = HANDLE;          // handle to a section of theme data for class
  56.   {$EXTERNALSYM HTHEME}
  57. //---------------------------------------------------------------------------
  58. // NOTE: PartId's and StateId's used in the theme API are defined in the
  59. //       hdr file <tmschema.h> using the TM_PART and TM_STATE macros.  For
  60. //       example, "TM_PART(BP, PUSHBUTTON)" defines the PartId "BP_PUSHBUTTON".
  61. //---------------------------------------------------------------------------
  62. //  OpenThemeData()     - Open the theme data for the specified HWND and
  63. //                        semi-colon separated list of class names.
  64. //
  65. //                        OpenThemeData() will try each class name, one at
  66. //                        a time, and use the first matching theme info
  67. //                        found.  If a match is found, a theme handle
  68. //                        to the data is returned.  If no match is found,
  69. //                        a "NULL" handle is returned.
  70. //
  71. //                        When the window is destroyed or a WM_THEMECHANGED
  72. //                        msg is received, "CloseThemeData()" should be
  73. //                        called to close the theme handle.
  74. //
  75. //  hwnd                - window handle of the control/window to be themed
  76. //
  77. //  pszClassList        - class name (or list of names) to match to theme data
  78. //                        section.  if the list contains more than one name,
  79. //                        the names are tested one at a time for a match.
  80. //                        If a match is found, OpenThemeData() returns a
  81. //                        theme handle associated with the matching class.
  82. //                        This param is a list (instead of just a single
  83. //                        class name) to provide the class an opportunity
  84. //                        to get the "best" match between the class and
  85. //                        the current theme.  For example, a button might
  86. //                        pass L"OkButton, Button" if its ID=ID_OK.  If
  87. //                        the current theme has an entry for OkButton,
  88. //                        that will be used.  Otherwise, we fall back on
  89. //                        the normal Button entry.
  90. //---------------------------------------------------------------------------
  91. function OpenThemeData(hwnd: HWND; pszClassList: LPCWSTR): HTHEME; stdcall;
  92. {$EXTERNALSYM OpenThemeData}
  93. //---------------------------------------------------------------------------
  94. //  CloseTHemeData()    - closes the theme data handle.  This should be done
  95. //                        when the window being themed is destroyed or
  96. //                        whenever a WM_THEMECHANGED msg is received
  97. //                        (followed by an attempt to create a new Theme data
  98. //                        handle).
  99. //
  100. //  hTheme              - open theme data handle (returned from prior call
  101. //                        to OpenThemeData() API).
  102. //---------------------------------------------------------------------------
  103. function CloseThemeData(hTheme: HTHEME): HRESULT; stdcall;
  104. {$EXTERNALSYM CloseThemeData}
  105. //---------------------------------------------------------------------------
  106. //    functions for basic drawing support
  107. //---------------------------------------------------------------------------
  108. // The following methods are the theme-aware drawing services.
  109. // Controls/Windows are defined in drawable "parts" by their author: a
  110. // parent part and 0 or more child parts.  Each of the parts can be
  111. // described in "states" (ex: disabled, hot, pressed).
  112. //---------------------------------------------------------------------------
  113. // For the list of all themed classes and the definition of all
  114. // parts and states, see the file "tmschmea.h".
  115. //---------------------------------------------------------------------------
  116. // Each of the below methods takes a "iPartId" param to specify the
  117. // part and a "iStateId" to specify the state of the part.
  118. // "iStateId=0" refers to the root part.  "iPartId" = "0" refers to
  119. // the root class.
  120. //-----------------------------------------------------------------------
  121. // Note: draw operations are always scaled to fit (and not to exceed)
  122. // the specified "Rect".
  123. //-----------------------------------------------------------------------
  124. //------------------------------------------------------------------------
  125. //  DrawThemeBackground()
  126. //                      - draws the theme-specified border and fill for
  127. //                        the "iPartId" and "iStateId".  This could be
  128. //                        based on a bitmap file, a border and fill, or
  129. //                        other image description.
  130. //
  131. //  hTheme              - theme data handle
  132. //  hdc                 - HDC to draw into
  133. //  iPartId             - part number to draw
  134. //  iStateId            - state number (of the part) to draw
  135. //  pRect               - defines the size/location of the part
  136. //  pClipRect           - optional clipping rect (don't draw outside it)
  137. //------------------------------------------------------------------------
  138. function DrawThemeBackground(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  139.   const pRect: RECT; pClipRect: PRECT): HRESULT; stdcall;
  140. {$EXTERNALSYM DrawThemeBackground}
  141. //---------------------------------------------------------------------------
  142. //----- DrawThemeText() flags ----
  143. const
  144.   DTT_GRAYED = $1;         // draw a grayed-out string
  145.   {$EXTERNALSYM DTT_GRAYED}
  146. //-------------------------------------------------------------------------
  147. //  DrawThemeText()     - draws the text using the theme-specified
  148. //                        color and font for the "iPartId" and
  149. //                        "iStateId".
  150. //
  151. //  hTheme              - theme data handle
  152. //  hdc                 - HDC to draw into
  153. //  iPartId             - part number to draw
  154. //  iStateId            - state number (of the part) to draw
  155. //  pszText             - actual text to draw
  156. //  dwCharCount         - number of chars to draw (-1 for all)
  157. //  dwTextFlags         - same as DrawText() "uFormat" param
  158. //  dwTextFlags2        - additional drawing options
  159. //  pRect               - defines the size/location of the part
  160. //-------------------------------------------------------------------------
  161. function DrawThemeText(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  162.   pszText: LPCWSTR; iCharCount: Integer; dwTextFlags, dwTextFlags2: DWORD;
  163.   const pRect: RECT): HRESULT; stdcall;
  164. {$EXTERNALSYM DrawThemeText}
  165. //-------------------------------------------------------------------------
  166. //  GetThemeBackgroundContentRect()
  167. //                      - gets the size of the content for the theme-defined
  168. //                        background.  This is usually the area inside
  169. //                        the borders or Margins.
  170. //
  171. //      hTheme          - theme data handle
  172. //      hdc             - (optional) device content to be used for drawing
  173. //      iPartId         - part number to draw
  174. //      iStateId        - state number (of the part) to draw
  175. //      pBoundingRect   - the outer RECT of the part being drawn
  176. //      pContentRect    - RECT to receive the content area
  177. //-------------------------------------------------------------------------
  178. function GetThemeBackgroundContentRect(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  179.   const pBoundingRect: RECT; pContentRect: PRECT): HRESULT; stdcall;
  180. {$EXTERNALSYM GetThemeBackgroundContentRect}
  181. //-------------------------------------------------------------------------
  182. //  GetThemeBackgroundExtent() - calculates the size/location of the theme-
  183. //                               specified background based on the
  184. //                               "pContentRect".
  185. //
  186. //      hTheme          - theme data handle
  187. //      hdc             - (optional) device content to be used for drawing
  188. //      iPartId         - part number to draw
  189. //      iStateId        - state number (of the part) to draw
  190. //      pContentRect    - RECT that defines the content area
  191. //      pBoundingRect   - RECT to receive the overall size/location of part
  192. //-------------------------------------------------------------------------
  193. function GetThemeBackgroundExtent(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  194.   const pContentRect: RECT; var pExtentRect: RECT): HRESULT; stdcall;
  195. {$EXTERNALSYM GetThemeBackgroundExtent}
  196. //-------------------------------------------------------------------------
  197. type
  198.   THEMESIZE = (
  199.     TS_MIN,             // minimum size
  200.     TS_TRUE,            // size without stretching
  201.     TS_DRAW);           // size that theme mgr will use to draw part
  202.   {$EXTERNALSYM THEMESIZE}
  203.   TThemeSize = THEMESIZE;
  204. //-------------------------------------------------------------------------
  205. //  GetThemePartSize() - returns the specified size of the theme part
  206. //
  207. //  hTheme              - theme data handle
  208. //  hdc                 - HDC to select font into & measure against
  209. //  iPartId             - part number to retrieve size for
  210. //  iStateId            - state number (of the part)
  211. //  prc                 - (optional) rect for part drawing destination
  212. //  eSize               - the type of size to be retreived
  213. //  psz                 - receives the specified size of the part
  214. //-------------------------------------------------------------------------
  215. function GetThemePartSize(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  216.   prc: PRECT; eSize: THEMESIZE; var psz: TSize): HRESULT; stdcall;
  217. {$EXTERNALSYM GetThemePartSize}
  218. //-------------------------------------------------------------------------
  219. //  GetThemeTextExtent() - calculates the size/location of the specified
  220. //                         text when rendered in the Theme Font.
  221. //
  222. //  hTheme              - theme data handle
  223. //  hdc                 - HDC to select font & measure into
  224. //  iPartId             - part number to draw
  225. //  iStateId            - state number (of the part)
  226. //  pszText             - the text to be measured
  227. //  dwCharCount         - number of chars to draw (-1 for all)
  228. //  dwTextFlags         - same as DrawText() "uFormat" param
  229. //  pszBoundingRect     - optional: to control layout of text
  230. //  pszExtentRect       - receives the RECT for text size/location
  231. //-------------------------------------------------------------------------
  232. function GetThemeTextExtent(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  233.   pszText: LPCWSTR; iCharCount: Integer; dwTextFlags: DWORD; pBoundingRect: PRECT;
  234.   var pExtentRect: RECT): HRESULT; stdcall;
  235. {$EXTERNALSYM GetThemeTextExtent}
  236. //-------------------------------------------------------------------------
  237. //  GetThemeTextMetrics()
  238. //                      - returns info about the theme-specified font
  239. //                        for the part/state passed in.
  240. //
  241. //  hTheme              - theme data handle
  242. //  hdc                 - optional: HDC for screen context
  243. //  iPartId             - part number to draw
  244. //  iStateId            - state number (of the part)
  245. //  ptm                 - receives the font info
  246. //-------------------------------------------------------------------------
  247. function GetThemeTextMetrics(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  248.   var ptm: TEXTMETRIC): HRESULT; stdcall;
  249. {$EXTERNALSYM GetThemeTextMetrics}
  250. //-------------------------------------------------------------------------
  251. //  GetThemeBackgroundRegion()
  252. //                      - computes the region for a regular or partially
  253. //                        transparent theme-specified background that is
  254. //                        bound by the specified "pRect".
  255. //                        If the rectangle is empty, sets the HRGN to NULL
  256. //                        and return S_FALSE.
  257. //
  258. //  hTheme              - theme data handle
  259. //  hdc                 - optional HDC to draw into (DPI scaling)
  260. //  iPartId             - part number to draw
  261. //  iStateId            - state number (of the part)
  262. //  pRect               - the RECT used to draw the part
  263. //  pRegion             - receives handle to calculated region
  264. //-------------------------------------------------------------------------
  265. function GetThemeBackgroundRegion(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  266.   const pRect: RECT; var pRegion: HRGN): HRESULT; stdcall;
  267. {$EXTERNALSYM GetThemeBackgroundRegion}
  268. //-------------------------------------------------------------------------
  269. //----- HitTestThemeBackground, HitTestThemeBackgroundRegion flags ----
  270. //  Theme background segment hit test flag (default). possible return values are:
  271. //  HTCLIENT: hit test succeeded in the middle background segment
  272. //  HTTOP, HTLEFT, HTTOPLEFT, etc:  // hit test succeeded in the the respective theme background segment.
  273. const
  274.   HTTB_BACKGROUNDSEG         = $0000;
  275.   {$EXTERNALSYM HTTB_BACKGROUNDSEG}
  276. //  Fixed border hit test option.  possible return values are:
  277. //  HTCLIENT: hit test succeeded in the middle background segment
  278. //  HTBORDER: hit test succeeded in any other background segment
  279.   HTTB_FIXEDBORDER           = $0002;  // Return code may be either HTCLIENT or HTBORDER.
  280.   {$EXTERNALSYM HTTB_FIXEDBORDER}
  281. //  Caption hit test option.  Possible return values are:
  282. //  HTCAPTION: hit test succeeded in the top, top left, or top right background segments
  283. //  HTNOWHERE or another return code, depending on absence or presence of accompanying flags, resp.
  284.   HTTB_CAPTION               = $0004;
  285.   {$EXTERNALSYM HTTB_CAPTION}
  286. //  Resizing border hit test flags.  Possible return values are:
  287. //  HTCLIENT: hit test succeeded in middle background segment
  288. //  HTTOP, HTTOPLEFT, HTLEFT, HTRIGHT, etc:    hit test succeeded in the respective system resizing zone
  289. //  HTBORDER: hit test failed in middle segment and resizing zones, but succeeded in a background border segment
  290.   HTTB_RESIZINGBORDER_LEFT   = $0010; // Hit test left resizing border,
  291.   {$EXTERNALSYM HTTB_RESIZINGBORDER_LEFT}
  292.   HTTB_RESIZINGBORDER_TOP    = $0020; // Hit test top resizing border
  293.   {$EXTERNALSYM HTTB_RESIZINGBORDER_TOP}
  294.   HTTB_RESIZINGBORDER_RIGHT  = $0040; // Hit test right resizing border
  295.   {$EXTERNALSYM HTTB_RESIZINGBORDER_RIGHT}
  296.   HTTB_RESIZINGBORDER_BOTTOM = $0080; // Hit test bottom resizing border
  297.   {$EXTERNALSYM HTTB_RESIZINGBORDER_BOTTOM}
  298.   HTTB_RESIZINGBORDER        = (HTTB_RESIZINGBORDER_LEFT or HTTB_RESIZINGBORDER_TOP or
  299.                                 HTTB_RESIZINGBORDER_RIGHT or HTTB_RESIZINGBORDER_BOTTOM);
  300.   {$EXTERNALSYM HTTB_RESIZINGBORDER}
  301. // Resizing border is specified as a template, not just window edges.
  302. // This option is mutually exclusive with HTTB_SYSTEMSIZINGWIDTH; HTTB_SIZINGTEMPLATE takes precedence
  303.   HTTB_SIZINGTEMPLATE        = $0100;
  304.   {$EXTERNALSYM HTTB_SIZINGTEMPLATE}
  305. // Use system resizing border width rather than theme content margins.
  306. // This option is mutually exclusive with HTTB_SIZINGTEMPLATE, which takes precedence.
  307.   HTTB_SYSTEMSIZINGMARGINS   = $0200;
  308.   {$EXTERNALSYM HTTB_SYSTEMSIZINGMARGINS}
  309. //-------------------------------------------------------------------------
  310. //  HitTestThemeBackground()
  311. //                      - returns a HitTestCode (a subset of the values
  312. //                        returned by WM_NCHITTEST) for the point "ptTest"
  313. //                        within the theme-specified background
  314. //                        (bound by pRect).  "pRect" and "ptTest" should
  315. //                        both be in the same coordinate system
  316. //                        (client, screen, etc).
  317. //
  318. //      hTheme          - theme data handle
  319. //      hdc             - HDC to draw into
  320. //      iPartId         - part number to test against
  321. //      iStateId        - state number (of the part)
  322. //      pRect           - the RECT used to draw the part
  323. //      hrgn            - optional region to use; must be in same coordinates as
  324. //                      -    pRect and pTest.
  325. //      ptTest          - the hit point to be tested
  326. //      dwOptions       - HTTB_xxx constants
  327. //      pwHitTestCode   - receives the returned hit test code - one of:
  328. //
  329. //                        HTNOWHERE, HTLEFT, HTTOPLEFT, HTBOTTOMLEFT,
  330. //                        HTRIGHT, HTTOPRIGHT, HTBOTTOMRIGHT,
  331. //                        HTTOP, HTBOTTOM, HTCLIENT
  332. //-------------------------------------------------------------------------
  333. function HitTestThemeBackground(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  334.   dwOptions: DWORD; const pRect: RECT; hrgn: HRGN; ptTest: POINT; var pwHitTestCode: WORD): HRESULT; stdcall;
  335. {$EXTERNALSYM HitTestThemeBackground}
  336. //------------------------------------------------------------------------
  337. //  DrawThemeEdge()     - Similar to the DrawEdge() API, but uses part colors
  338. //                        and is high-DPI aware
  339. //  hTheme              - theme data handle
  340. //  hdc                 - HDC to draw into
  341. //  iPartId             - part number to draw
  342. //  iStateId            - state number of part
  343. //  pDestRect           - the RECT used to draw the line(s)
  344. //  uEdge               - Same as DrawEdge() API
  345. //  uFlags              - Same as DrawEdge() API
  346. //  pContentRect        - Receives the interior rect if (uFlags & BF_ADJUST)
  347. //------------------------------------------------------------------------
  348. function DrawThemeEdge(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  349.   const pDestRect: RECT; uEdge, uFlags: UINT; pContentRect: PRECT): HRESULT; stdcall;
  350. {$EXTERNALSYM DrawThemeEdge}
  351. //------------------------------------------------------------------------
  352. //  DrawThemeIcon()     - draws an image within an imagelist based on
  353. //                        a (possible) theme-defined effect.
  354. //
  355. //  hTheme              - theme data handle
  356. //  hdc                 - HDC to draw into
  357. //  iPartId             - part number to draw
  358. //  iStateId            - state number of part
  359. //  pRect               - the RECT to draw the image within
  360. //  himl                - handle to IMAGELIST
  361. //  iImageIndex         - index into IMAGELIST (which icon to draw)
  362. //------------------------------------------------------------------------
  363. function DrawThemeIcon(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
  364.   const pRect: RECT; himl: HIMAGELIST; iImageIndex: Integer): HRESULT; stdcall;
  365. {$EXTERNALSYM DrawThemeIcon}
  366. //---------------------------------------------------------------------------
  367. //  IsThemePartDefined() - returns TRUE if the theme has defined parameters
  368. //                         for the specified "iPartId" and "iStateId".
  369. //
  370. //  hTheme              - theme data handle
  371. //  iPartId             - part number to find definition for
  372. //  iStateId            - state number of part
  373. //---------------------------------------------------------------------------
  374. function IsThemePartDefined(hTheme: HTHEME; iPartId, iStateId: Integer): BOOL; stdcall;
  375. {$EXTERNALSYM IsThemePartDefined}
  376. //---------------------------------------------------------------------------
  377. //  IsThemeBackgroundPartiallyTransparent()
  378. //                      - returns TRUE if the theme specified background for
  379. //                        the part/state has transparent pieces or
  380. //                        alpha-blended pieces.
  381. //
  382. //  hTheme              - theme data handle
  383. //  iPartId             - part number
  384. //  iStateId            - state number of part
  385. //---------------------------------------------------------------------------
  386. function IsThemeBackgroundPartiallyTransparent(hTheme: HTHEME; iPartId, iStateId: Integer): BOOL; stdcall;
  387. {$EXTERNALSYM IsThemeBackgroundPartiallyTransparent}
  388. //---------------------------------------------------------------------------
  389. //    lower-level theme information services
  390. //---------------------------------------------------------------------------
  391. // The following methods are getter routines for each of the Theme Data types.
  392. // Controls/Windows are defined in drawable "parts" by their author: a
  393. // parent part and 0 or more child parts.  Each of the parts can be
  394. // described in "states" (ex: disabled, hot, pressed).
  395. //---------------------------------------------------------------------------
  396. // Each of the below methods takes a "iPartId" param to specify the
  397. // part and a "iStateId" to specify the state of the part.
  398. // "iStateId=0" refers to the root part.  "iPartId" = "0" refers to
  399. // the root class.
  400. //-----------------------------------------------------------------------
  401. // Each method also take a "iPropId" param because multiple instances of
  402. // the same primitive type can be defined in the theme schema.
  403. //-----------------------------------------------------------------------
  404. //-----------------------------------------------------------------------
  405. //  GetThemeColor()     - Get the value for the specified COLOR property
  406. //
  407. //  hTheme              - theme data handle
  408. //  iPartId             - part number
  409. //  iStateId            - state number of part
  410. //  iPropId             - the property number to get the value for
  411. //  pColor              - receives the value of the property
  412. //-----------------------------------------------------------------------
  413. function GetThemeColor(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
  414.   var pColor: COLORREF): HRESULT; stdcall;
  415. {$EXTERNALSYM GetThemeColor}
  416. //-----------------------------------------------------------------------
  417. //  GetThemeMetric()    - Get the value for the specified metric/size
  418. //                        property
  419. //
  420. //  hTheme              - theme data handle
  421. //  hdc                 - (optional) hdc to be drawn into (DPI scaling)
  422. //  iPartId             - part number
  423. //  iStateId            - state number of part
  424. //  iPropId             - the property number to get the value for
  425. //  piVal               - receives the value of the property
  426. //-----------------------------------------------------------------------
  427. function GetThemeMetric(hTheme: HTHEME; hdc: HDC; iPartId, iStateId, iPropId: Integer;
  428.   var piVal: Integer): HRESULT; stdcall;
  429. {$EXTERNALSYM GetThemeMetric}
  430. //-----------------------------------------------------------------------
  431. //  GetThemeString()    - Get the value for the specified string property
  432. //
  433. //  hTheme              - theme data handle
  434. //  iPartId             - part number
  435. //  iStateId            - state number of part
  436. //  iPropId             - the property number to get the value for
  437. //  pszBuff             - receives the string property value
  438. //  cchMaxBuffChars     - max. number of chars allowed in pszBuff
  439. //-----------------------------------------------------------------------
  440. function GetThemeString(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
  441.   pszBuff: LPWSTR; cchMaxBuffChars: Integer): HRESULT; stdcall;
  442. {$EXTERNALSYM GetThemeString}
  443. //-----------------------------------------------------------------------
  444. //  GetThemeBool()      - Get the value for the specified BOOL property
  445. //
  446. //  hTheme              - theme data handle
  447. //  iPartId             - part number
  448. //  iStateId            - state number of part
  449. //  iPropId             - the property number to get the value for
  450. //  pfVal               - receives the value of the property
  451. //-----------------------------------------------------------------------
  452. function GetThemeBool(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
  453.   var pfVal: BOOL): HRESULT; stdcall;
  454. {$EXTERNALSYM GetThemeBool}
  455. //-----------------------------------------------------------------------
  456. //  GetThemeInt()       - Get the value for the specified int property
  457. //
  458. //  hTheme              - theme data handle
  459. //  iPartId             - part number
  460. //  iStateId            - state number of part
  461. //  iPropId             - the property number to get the value for
  462. //  piVal               - receives the value of the property
  463. //-----------------------------------------------------------------------
  464. function GetThemeInt(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
  465.   var piVal: Integer): HRESULT; stdcall;
  466. {$EXTERNALSYM GetThemeInt}
  467. //-----------------------------------------------------------------------
  468. //  GetThemeEnumValue() - Get the value for the specified ENUM property
  469. //
  470. //  hTheme              - theme data handle
  471. //  iPartId             - part number
  472. //  iStateId            - state number of part
  473. //  iPropId             - the property number to get the value for
  474. //  piVal               - receives the value of the enum (cast to int*)
  475. //-----------------------------------------------------------------------
  476. function GetThemeEnumValue(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
  477.   var piVal: Integer): HRESULT; stdcall;
  478. {$EXTERNALSYM GetThemeEnumValue}
  479. //-----------------------------------------------------------------------
  480. //  GetThemePosition()  - Get the value for the specified position
  481. //                        property
  482. //
  483. //  hTheme              - theme data handle
  484. //  iPartId             - part number
  485. //  iStateId            - state number of part
  486. //  iPropId             - the property number to get the value for
  487. //  pPoint              - receives the value of the position property
  488. //-----------------------------------------------------------------------
  489. function GetThemePosition(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
  490.   var pPoint: POINT): HRESULT; stdcall;
  491. {$EXTERNALSYM GetThemePosition}
  492. //-----------------------------------------------------------------------
  493. //  GetThemeFont()      - Get the value for the specified font property
  494. //
  495. //  hTheme              - theme data handle
  496. //  hdc                 - (optional) hdc to be drawn to (DPI scaling)
  497. //  iPartId             - part number
  498. //  iStateId            - state number of part
  499. //  iPropId             - the property number to get the value for
  500. //  pFont               - receives the value of the LOGFONT property
  501. //                        (scaled for the current logical screen dpi)
  502. //-----------------------------------------------------------------------
  503. function GetThemeFont(hTheme: HTHEME; hdc: HDC; iPartId, iStateId, iPropId: Integer;
  504.   var pFont: LOGFONT): HRESULT; stdcall;
  505. {$EXTERNALSYM GetThemeFont}
  506. //-----------------------------------------------------------------------
  507. //  GetThemeRect()      - Get the value for the specified RECT property
  508. //
  509. //  hTheme              - theme data handle
  510. //  iPartId             - part number
  511. //  iStateId            - state number of part
  512. //  iPropId             - the property number to get the value for
  513. //  pRect               - receives the value of the RECT property
  514. //-----------------------------------------------------------------------
  515. function GetThemeRect(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
  516.   var pRect: RECT): HRESULT; stdcall;
  517. {$EXTERNALSYM GetThemeRect}
  518. //-----------------------------------------------------------------------
  519. type
  520.   _MARGINS = record
  521.     cxLeftWidth: Integer;      // width of left border that retains its size
  522.     cxRightWidth: Integer;     // width of right border that retains its size
  523.     cyTopHeight: Integer;      // height of top border that retains its size
  524.     cyBottomHeight: Integer;   // height of bottom border that retains its size
  525.   end;
  526.   {$EXTERNALSYM _MARGINS}
  527.   MARGINS = _MARGINS;
  528.   {$EXTERNALSYM MARGINS}
  529.   PMARGINS = ^MARGINS;
  530.   {$EXTERNALSYM PMARGINS}
  531.   TMargins = MARGINS;
  532. //-----------------------------------------------------------------------
  533. //  GetThemeMargins()   - Get the value for the specified MARGINS property
  534. //
  535. //      hTheme          - theme data handle
  536. //      hdc             - (optional) hdc to be used for drawing
  537. //      iPartId         - part number
  538. //      iStateId        - state number of part
  539. //      iPropId         - the property number to get the value for
  540. //      prc             - RECT for area to be drawn into
  541. //      pMargins        - receives the value of the MARGINS property
  542. //-----------------------------------------------------------------------
  543. function GetThemeMargins(hTheme: HTHEME; hdc: HDC; iPartId, iStateId, iPropId: Integer;
  544.   prc: PRECT; var pMargins: MARGINS): HRESULT; stdcall;
  545. {$EXTERNALSYM GetThemeMargins}
  546. //-----------------------------------------------------------------------
  547. const
  548.   MAX_INTLIST_COUNT = 10;
  549.   {$EXTERNALSYM MAX_INTLIST_COUNT}
  550. type
  551.   _INTLIST = record
  552.     iValueCount: Integer;      // number of values in iValues
  553.     iValues: array [0..MAX_INTLIST_COUNT - 1] of Integer;
  554.   end;
  555.   {$EXTERNALSYM _INTLIST}
  556.   INTLIST = _INTLIST;
  557.   {$EXTERNALSYM INTLIST}
  558.   PINTLIST = ^INTLIST;
  559.   {$EXTERNALSYM PINTLIST}
  560.   TIntList = INTLIST;
  561. //-----------------------------------------------------------------------
  562. //  GetThemeIntList()   - Get the value for the specified INTLIST struct
  563. //
  564. //      hTheme          - theme data handle
  565. //      iPartId         - part number
  566. //      iStateId        - state number of part
  567. //      iPropId         - the property number to get the value for
  568. //      pIntList        - receives the value of the INTLIST property
  569. //-----------------------------------------------------------------------
  570. function GetThemeIntList(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
  571.   var pIntList: INTLIST): HRESULT; stdcall;
  572. {$EXTERNALSYM GetThemeIntList}
  573. //-----------------------------------------------------------------------
  574. type
  575.   PROPERTYORIGIN = (
  576.     PO_STATE,           // property was found in the state section
  577.     PO_PART,            // property was found in the part section
  578.     PO_CLASS,           // property was found in the class section
  579.     PO_GLOBAL,          // property was found in [globals] section
  580.     PO_NOTFOUND);       // property was not found
  581.   {$EXTERNALSYM PROPERTYORIGIN}
  582.   TPropertyOrigin = PROPERTYORIGIN;
  583. //-----------------------------------------------------------------------
  584. //  GetThemePropertyOrigin()
  585. //                      - searches for the specified theme property
  586. //                        and sets "pOrigin" to indicate where it was
  587. //                        found (or not found)
  588. //
  589. //  hTheme              - theme data handle
  590. //  iPartId             - part number
  591. //  iStateId            - state number of part
  592. //  iPropId             - the property number to search for
  593. //  pOrigin             - receives the value of the property origin
  594. //-----------------------------------------------------------------------
  595. function GetThemePropertyOrigin(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
  596.   var pOrigin: PROPERTYORIGIN): HRESULT; stdcall;
  597. {$EXTERNALSYM GetThemePropertyOrigin}
  598. //---------------------------------------------------------------------------
  599. //  SetWindowTheme()
  600. //                      - redirects an existing Window to use a different
  601. //                        section of the current theme information than its
  602. //                        class normally asks for.
  603. //
  604. //  hwnd                - the handle of the window (cannot be NULL)
  605. //
  606. //  pszSubAppName       - app (group) name to use in place of the calling
  607. //                        app's name.  If NULL, the actual calling app
  608. //                        name will be used.
  609. //
  610. //  pszSubIdList        - semicolon separated list of class Id names to
  611. //                        use in place of actual list passed by the
  612. //                        window's class.  if NULL, the id list from the
  613. //                        calling class is used.
  614. //---------------------------------------------------------------------------
  615. // The Theme Manager will remember the "pszSubAppName" and the
  616. // "pszSubIdList" associations thru the lifetime of the window (even
  617. // if themes are subsequently changed).  The window is sent a
  618. // "WM_THEMECHANGED" msg at the end of this call, so that the new
  619. // theme can be found and applied.
  620. //---------------------------------------------------------------------------
  621. // When "pszSubAppName" or "pszSubIdList" are NULL, the Theme Manager
  622. // removes the previously remember association.  To turn off theme-ing for
  623. // the specified window, you can pass an empty string (L"") so it
  624. // won't match any section entries.
  625. //---------------------------------------------------------------------------
  626. function SetWindowTheme(hwnd: HWND; pszSubAppName: LPCWSTR; pszSubIdList: LPCWSTR): HRESULT; stdcall;
  627. {$EXTERNALSYM SetWindowTheme}
  628. //---------------------------------------------------------------------------
  629. //  GetThemeFilename()  - Get the value for the specified FILENAME property.
  630. //
  631. //  hTheme              - theme data handle
  632. //  iPartId             - part number
  633. //  iStateId            - state number of part
  634. //  iPropId             - the property number to search for
  635. //  pszThemeFileName    - output buffer to receive the filename
  636. //  cchMaxBuffChars     - the size of the return buffer, in chars
  637. //---------------------------------------------------------------------------
  638. function GetThemeFilename(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
  639.   pszThemeFileName: LPWSTR; cchMaxBuffChars: Integer): HRESULT; stdcall;
  640. {$EXTERNALSYM GetThemeFilename}
  641. //---------------------------------------------------------------------------
  642. //  GetThemeSysColor()  - Get the value of the specified System color.
  643. //
  644. //  hTheme              - the theme data handle.  if non-NULL, will return
  645. //                        color from [SysMetrics] section of theme.
  646. //                        if NULL, will return the global system color.
  647. //
  648. //  iColorId            - the system color index defined in winuser.h
  649. //---------------------------------------------------------------------------
  650. function GetThemeSysColor(hTheme: HTHEME; iColorId: Integer): COLORREF; stdcall;
  651. {$EXTERNALSYM GetThemeSysColor}
  652. //---------------------------------------------------------------------------
  653. //  GetThemeSysColorBrush()
  654. //                      - Get the brush for the specified System color.
  655. //
  656. //  hTheme              - the theme data handle.  if non-NULL, will return
  657. //                        brush matching color from [SysMetrics] section of
  658. //                        theme.  if NULL, will return the brush matching
  659. //                        global system color.
  660. //
  661. //  iColorId            - the system color index defined in winuser.h
  662. //---------------------------------------------------------------------------
  663. function GetThemeSysColorBrush(hTheme: HTHEME; iColorId: Integer): HBRUSH; stdcall;
  664. {$EXTERNALSYM GetThemeSysColorBrush}
  665. //---------------------------------------------------------------------------
  666. //  GetThemeSysBool()   - Get the boolean value of specified System metric.
  667. //
  668. //  hTheme              - the theme data handle.  if non-NULL, will return
  669. //                        BOOL from [SysMetrics] section of theme.
  670. //                        if NULL, will return the specified system boolean.
  671. //
  672. //  iBoolId             - the TMT_XXX BOOL number (first BOOL
  673. //                        is TMT_FLATMENUS)
  674. //---------------------------------------------------------------------------
  675. function GetThemeSysBool(hTheme: HTHEME; iBoolId: Integer): BOOL; stdcall;
  676. {$EXTERNALSYM GetThemeSysBool}
  677. //---------------------------------------------------------------------------
  678. //  GetThemeSysSize()   - Get the value of the specified System size metric.
  679. //                        (scaled for the current logical screen dpi)
  680. //
  681. //  hTheme              - the theme data handle.  if non-NULL, will return
  682. //                        size from [SysMetrics] section of theme.
  683. //                        if NULL, will return the global system metric.
  684. //
  685. //  iSizeId             - the following values are supported when
  686. //                        hTheme is non-NULL:
  687. //
  688. //                          SM_CXBORDER   (border width)
  689. //                          SM_CXVSCROLL  (scrollbar width)
  690. //                          SM_CYHSCROLL  (scrollbar height)
  691. //                          SM_CXSIZE     (caption width)
  692. //                          SM_CYSIZE     (caption height)
  693. //                          SM_CXSMSIZE   (small caption width)
  694. //                          SM_CYSMSIZE   (small caption height)
  695. //                          SM_CXMENUSIZE (menubar width)
  696. //                          SM_CYMENUSIZE (menubar height)
  697. //
  698. //                        when hTheme is NULL, iSizeId is passed directly
  699. //                        to the GetSystemMetrics() function
  700. //---------------------------------------------------------------------------
  701. function GetThemeSysSize(hTheme: HTHEME; iSizeId: Integer): Integer; stdcall;
  702. {$EXTERNALSYM GetThemeSysSize}
  703. //---------------------------------------------------------------------------
  704. //  GetThemeSysFont()   - Get the LOGFONT for the specified System font.
  705. //
  706. //  hTheme              - the theme data handle.  if non-NULL, will return
  707. //                        font from [SysMetrics] section of theme.
  708. //                        if NULL, will return the specified system font.
  709. //
  710. //  iFontId             - the TMT_XXX font number (first font
  711. //                        is TMT_CAPTIONFONT)
  712. //
  713. //  plf                 - ptr to LOGFONT to receive the font value.
  714. //                        (scaled for the current logical screen dpi)
  715. //---------------------------------------------------------------------------
  716. function GetThemeSysFont(hTheme: HTHEME; iFontId: Integer; var plf: LOGFONT): HRESULT; stdcall;
  717. {$EXTERNALSYM GetThemeSysFont}
  718. //---------------------------------------------------------------------------
  719. //  GetThemeSysString() - Get the value of specified System string metric.
  720. //
  721. //  hTheme              - the theme data handle (required)
  722. //
  723. //  iStringId           - must be one of the following values:
  724. //
  725. //                          TMT_CSSNAME
  726. //                          TMT_XMLNAME
  727. //
  728. //  pszStringBuff       - the buffer to receive the string value
  729. //
  730. //  cchMaxStringChars   - max. number of chars that pszStringBuff can hold
  731. //---------------------------------------------------------------------------
  732. function GetThemeSysString(hTheme: HTHEME; iStringId: Integer;
  733.   pszStringBuff: LPWSTR; cchMaxStringChars: Integer): HRESULT; stdcall;
  734. {$EXTERNALSYM GetThemeSysString}
  735. //---------------------------------------------------------------------------
  736. //  GetThemeSysInt() - Get the value of specified System int.
  737. //
  738. //  hTheme              - the theme data handle (required)
  739. //
  740. //  iIntId              - must be one of the following values:
  741. //
  742. //                          TMT_DPIX
  743. //                          TMT_DPIY
  744. //                          TMT_MINCOLORDEPTH
  745. //
  746. //  piValue             - ptr to int to receive value
  747. //---------------------------------------------------------------------------
  748. function GetThemeSysInt(hTheme: HTHEME; iIntId: Integer; var piValue: Integer): HRESULT; stdcall;
  749. {$EXTERNALSYM GetThemeSysInt}
  750. //---------------------------------------------------------------------------
  751. //  IsThemeActive()     - can be used to test if a system theme is active
  752. //                        for the current user session.
  753. //
  754. //                        use the API "IsAppThemed()" to test if a theme is
  755. //                        active for the calling process.
  756. //---------------------------------------------------------------------------
  757. function IsThemeActive: BOOL; stdcall;
  758. {$EXTERNALSYM IsThemeActive}
  759. //---------------------------------------------------------------------------
  760. //  IsAppThemed()       - returns TRUE if a theme is active and available to
  761. //                        the current process
  762. //---------------------------------------------------------------------------
  763. function IsAppThemed: BOOL; stdcall;
  764. {$EXTERNALSYM IsAppThemed}
  765. //---------------------------------------------------------------------------
  766. //  GetWindowTheme()    - if window is themed, returns its most recent
  767. //                        HTHEME from OpenThemeData() - otherwise, returns
  768. //                        NULL.
  769. //
  770. //      hwnd            - the window to get the HTHEME of
  771. //---------------------------------------------------------------------------
  772. function GetWindowTheme(hwnd: HWND): HTHEME; stdcall;
  773. {$EXTERNALSYM GetWindowTheme}
  774. //---------------------------------------------------------------------------
  775. //  EnableThemeDialogTexture()
  776. //
  777. //  - Enables/disables dialog background theme.  This method can be used to
  778. //    tailor dialog compatibility with child windows and controls that
  779. //    may or may not coordinate the rendering of their client area backgrounds
  780. //    with that of their parent dialog in a manner that supports seamless
  781. //    background texturing.
  782. //
  783. //      hdlg         - the window handle of the target dialog
  784. //      dwFlags      - ETDT_ENABLE to enable the theme-defined dialog background texturing,
  785. //                     ETDT_DISABLE to disable background texturing,
  786. //                     ETDT_ENABLETAB to enable the theme-defined background
  787. //                          texturing using the Tab texture
  788. //---------------------------------------------------------------------------
  789. const
  790.   ETDT_DISABLE       = $00000001;
  791.   {$EXTERNALSYM ETDT_DISABLE}
  792.   ETDT_ENABLE        = $00000002;
  793.   {$EXTERNALSYM ETDT_ENABLE}
  794.   ETDT_USETABTEXTURE = $00000004;
  795.   {$EXTERNALSYM ETDT_USETABTEXTURE}
  796.   ETDT_ENABLETAB     = (ETDT_ENABLE or ETDT_USETABTEXTURE);
  797.   {$EXTERNALSYM ETDT_ENABLETAB}
  798. function EnableThemeDialogTexture(hwnd: HWND; dwFlags: DWORD): HRESULT; stdcall;
  799. {$EXTERNALSYM EnableThemeDialogTexture}
  800. //---------------------------------------------------------------------------
  801. //  IsThemeDialogTextureEnabled()
  802. //
  803. //  - Reports whether the dialog supports background texturing.
  804. //
  805. //      hdlg         - the window handle of the target dialog
  806. //---------------------------------------------------------------------------
  807. function IsThemeDialogTextureEnabled(hwnd: HWND): BOOL; stdcall;
  808. {$EXTERNALSYM IsThemeDialogTextureEnabled}
  809. //---------------------------------------------------------------------------
  810. //---- flags to control theming within an app ----
  811. const
  812.   STAP_ALLOW_NONCLIENT   = (1 shl 0);
  813.   {$EXTERNALSYM STAP_ALLOW_NONCLIENT}
  814.   STAP_ALLOW_CONTROLS    = (1 shl 1);
  815.   {$EXTERNALSYM STAP_ALLOW_CONTROLS}
  816.   STAP_ALLOW_WEBCONTENT  = (1 shl 2);
  817.   {$EXTERNALSYM STAP_ALLOW_WEBCONTENT}
  818. //---------------------------------------------------------------------------
  819. //  GetThemeAppProperties()
  820. //                      - returns the app property flags that control theming
  821. //---------------------------------------------------------------------------
  822. function GetThemeAppProperties: DWORD; stdcall;
  823. {$EXTERNALSYM GetThemeAppProperties}
  824. //---------------------------------------------------------------------------
  825. //  SetThemeAppProperties()
  826. //                      - sets the flags that control theming within the app
  827. //
  828. //      dwFlags         - the flag values to be set
  829. //---------------------------------------------------------------------------
  830. procedure SetThemeAppProperties(dwFlags: DWORD); stdcall;
  831. {$EXTERNALSYM SetThemeAppProperties}
  832. //---------------------------------------------------------------------------
  833. //  GetCurrentThemeName()
  834. //                      - Get the name of the current theme in-use.
  835. //                        Optionally, return the ColorScheme name and the
  836. //                        Size name of the theme.
  837. //
  838. //  pszThemeFileName    - receives the theme path & filename
  839. //  cchMaxNameChars     - max chars allowed in pszNameBuff
  840. //
  841. //  pszColorBuff        - (optional) receives the canonical color scheme name
  842. //                        (not the display name)
  843. //  cchMaxColorChars    - max chars allowed in pszColorBuff
  844. //
  845. //  pszSizeBuff         - (optional) receives the canonical size name
  846. //                        (not the display name)
  847. //  cchMaxSizeChars     - max chars allowed in pszSizeBuff
  848. //---------------------------------------------------------------------------
  849. function GetCurrentThemeName(pszThemeFileName: LPWSTR; cchMaxNameChars: Integer; pszColorBuff: LPWSTR;
  850.   cchMaxColorChars: Integer; pszSizeBuff: LPWSTR; cchMaxSizeChars: Integer): HRESULT; stdcall;
  851. {$EXTERNALSYM GetCurrentThemeName}
  852. //---------------------------------------------------------------------------
  853. //  GetThemeDocumentationProperty()
  854. //                      - Get the value for the specified property name from
  855. //                        the [documentation] section of the themes.ini file
  856. //                        for the specified theme.  If the property has been
  857. //                        localized in the theme files string table, the
  858. //                        localized version of the property value is returned.
  859. //
  860. //  pszThemeFileName    - filename of the theme file to query
  861. //  pszPropertyName     - name of the string property to retreive a value for
  862. //  pszValueBuff        - receives the property string value
  863. //  cchMaxValChars      - max chars allowed in pszValueBuff
  864. //---------------------------------------------------------------------------
  865. const
  866.   SZ_THDOCPROP_DISPLAYNAME               = WideString('DisplayName');
  867.   {$EXTERNALSYM SZ_THDOCPROP_DISPLAYNAME}
  868.   SZ_THDOCPROP_CANONICALNAME             = WideString('ThemeName');
  869.   {$EXTERNALSYM SZ_THDOCPROP_CANONICALNAME}
  870.   SZ_THDOCPROP_TOOLTIP                   = WideString('ToolTip');
  871.   {$EXTERNALSYM SZ_THDOCPROP_TOOLTIP}
  872.   SZ_THDOCPROP_AUTHOR                    = WideString('author');
  873.   {$EXTERNALSYM SZ_THDOCPROP_AUTHOR}
  874. function GetThemeDocumentationProperty(pszThemeName, pszPropertyName: LPCWSTR;
  875.   pszValueBuff: LPWSTR; cchMaxValChars: Integer): HRESULT; stdcall;
  876. {$EXTERNALSYM GetThemeDocumentationProperty}
  877. //---------------------------------------------------------------------------
  878. //  Theme API Error Handling
  879. //
  880. //      All functions in the Theme API not returning an HRESULT (THEMEAPI_)
  881. //      use the WIN32 function "SetLastError()" to record any call failures.
  882. //
  883. //      To retreive the error code of the last failure on the
  884. //      current thread for these type of API's, use the WIN32 function
  885. //      "GetLastError()".
  886. //
  887. //      All Theme API error codes (HRESULT's and GetLastError() values)
  888. //      should be normal win32 errors which can be formatted into
  889. //      strings using the Win32 API FormatMessage().
  890. //---------------------------------------------------------------------------
  891. //---------------------------------------------------------------------------
  892. // DrawThemeParentBackground()
  893. //                      - used by partially-transparent or alpha-blended
  894. //                        child controls to draw the part of their parent
  895. //                        that they appear in front of.
  896. //
  897. //  hwnd                - handle of the child control
  898. //  hdc                 - hdc of the child control
  899. //  prc                 - (optional) rect that defines the area to be
  900. //                        drawn (CHILD coordinates)
  901. //---------------------------------------------------------------------------
  902. function DrawThemeParentBackground(hwnd: HWND; hdc: HDC; prc: PRECT): HRESULT; stdcall;
  903. {$EXTERNALSYM DrawThemeParentBackground}
  904. //---------------------------------------------------------------------------
  905. //  EnableTheming()     - enables or disables themeing for the current user
  906. //                        in the current and future sessions.
  907. //
  908. //  fEnable             - if FALSE, disable theming & turn themes off.
  909. //                      - if TRUE, enable themeing and, if user previously
  910. //                        had a theme active, make it active now.
  911. //---------------------------------------------------------------------------
  912. function EnableTheming(fEnable: BOOL): HRESULT; stdcall;
  913. {$EXTERNALSYM EnableTheming}
  914. implementation
  915. const
  916.   themelib = 'uxtheme.dll';
  917. {$IFDEF DYNAMIC_LINK}
  918. var
  919.   _OpenThemeData: Pointer;
  920. function OpenThemeData;
  921. begin
  922.   GetProcedureAddress(_OpenThemeData, themelib, 'OpenThemeData');
  923.   asm
  924.     mov esp, ebp
  925.     pop ebp
  926.     jmp [_OpenThemeData]
  927.   end;
  928. end;
  929. {$ELSE}
  930. function OpenThemeData; external themelib name 'OpenThemeData';
  931. {$ENDIF DYNAMIC_LINK}
  932. {$IFDEF DYNAMIC_LINK}
  933. var
  934.   _CloseThemeData: Pointer;
  935. function CloseThemeData;
  936. begin
  937.   GetProcedureAddress(_CloseThemeData, themelib, 'CloseThemeData');
  938.   asm
  939.     mov esp, ebp
  940.     pop ebp
  941.     jmp [_CloseThemeData]
  942.   end;
  943. end;
  944. {$ELSE}
  945. function CloseThemeData; external themelib name 'CloseThemeData';
  946. {$ENDIF DYNAMIC_LINK}
  947. {$IFDEF DYNAMIC_LINK}
  948. var
  949.   _DrawThemeBackground: Pointer;
  950. function DrawThemeBackground;
  951. begin
  952.   GetProcedureAddress(_DrawThemeBackground, themelib, 'DrawThemeBackground');
  953.   asm
  954.     mov esp, ebp
  955.     pop ebp
  956.     jmp [_DrawThemeBackground]
  957.   end;
  958. end;
  959. {$ELSE}
  960. function DrawThemeBackground; external themelib name 'DrawThemeBackground';
  961. {$ENDIF DYNAMIC_LINK}
  962. {$IFDEF DYNAMIC_LINK}
  963. var
  964.   _DrawThemeText: Pointer;
  965. function DrawThemeText;
  966. begin
  967.   GetProcedureAddress(_DrawThemeText, themelib, 'DrawThemeText');
  968.   asm
  969.     mov esp, ebp
  970.     pop ebp
  971.     jmp [_DrawThemeText]
  972.   end;
  973. end;
  974. {$ELSE}
  975. function DrawThemeText; external themelib name 'DrawThemeText';
  976. {$ENDIF DYNAMIC_LINK}
  977. {$IFDEF DYNAMIC_LINK}
  978. var
  979.   _GetThemeBackgroundContentRect: Pointer;
  980. function GetThemeBackgroundContentRect;
  981. begin
  982.   GetProcedureAddress(_GetThemeBackgroundContentRect, themelib, 'GetThemeBackgroundContentRect');
  983.   asm
  984.     mov esp, ebp
  985.     pop ebp
  986.     jmp [_GetThemeBackgroundContentRect]
  987.   end;
  988. end;
  989. {$ELSE}
  990. function GetThemeBackgroundContentRect; external themelib name 'GetThemeBackgroundContentRect';
  991. {$ENDIF DYNAMIC_LINK}
  992. {$IFDEF DYNAMIC_LINK}
  993. var
  994.   _GetThemeBackgroundExtent: Pointer;
  995. function GetThemeBackgroundExtent;
  996. begin
  997.   GetProcedureAddress(_GetThemeBackgroundExtent, themelib, 'GetThemeBackgroundContentRect');
  998.   asm
  999.     mov esp, ebp
  1000.     pop ebp
  1001.     jmp [_GetThemeBackgroundExtent]
  1002.   end;
  1003. end;
  1004. {$ELSE}
  1005. function GetThemeBackgroundExtent; external themelib name 'GetThemeBackgroundContentRect';
  1006. {$ENDIF DYNAMIC_LINK}
  1007. {$IFDEF DYNAMIC_LINK}
  1008. var
  1009.   _GetThemePartSize: Pointer;
  1010. function GetThemePartSize;
  1011. begin
  1012.   GetProcedureAddress(_GetThemePartSize, themelib, 'GetThemePartSize');
  1013.   asm
  1014.     mov esp, ebp
  1015.     pop ebp
  1016.     jmp [_GetThemePartSize]
  1017.   end;
  1018. end;
  1019. {$ELSE}
  1020. function GetThemePartSize; external themelib name 'GetThemePartSize';
  1021. {$ENDIF DYNAMIC_LINK}
  1022. {$IFDEF DYNAMIC_LINK}
  1023. var
  1024.   _GetThemeTextExtent: Pointer;
  1025. function GetThemeTextExtent;
  1026. begin
  1027.   GetProcedureAddress(_GetThemeTextExtent, themelib, 'GetThemeTextExtent');
  1028.   asm
  1029.     mov esp, ebp
  1030.     pop ebp
  1031.     jmp [_GetThemeTextExtent]
  1032.   end;
  1033. end;
  1034. {$ELSE}
  1035. function GetThemeTextExtent; external themelib name 'GetThemeTextExtent';
  1036. {$ENDIF DYNAMIC_LINK}
  1037. {$IFDEF DYNAMIC_LINK}
  1038. var
  1039.   _GetThemeTextMetrics: Pointer;
  1040. function GetThemeTextMetrics;
  1041. begin
  1042.   GetProcedureAddress(_GetThemeTextMetrics, themelib, 'GetThemeTextMetrics');
  1043.   asm
  1044.     mov esp, ebp
  1045.     pop ebp
  1046.     jmp [_GetThemeTextMetrics]
  1047.   end;
  1048. end;
  1049. {$ELSE}
  1050. function GetThemeTextMetrics; external themelib name 'GetThemeTextMetrics';
  1051. {$ENDIF DYNAMIC_LINK}
  1052. {$IFDEF DYNAMIC_LINK}
  1053. var
  1054.   _GetThemeBackgroundRegion: Pointer;
  1055. function GetThemeBackgroundRegion;
  1056. begin
  1057.   GetProcedureAddress(_GetThemeBackgroundRegion, themelib, 'GetThemeBackgroundRegion');
  1058.   asm
  1059.     mov esp, ebp
  1060.     pop ebp
  1061.     jmp [_GetThemeBackgroundRegion]
  1062.   end;
  1063. end;
  1064. {$ELSE}
  1065. function GetThemeBackgroundRegion; external themelib name 'GetThemeBackgroundRegion';
  1066. {$ENDIF DYNAMIC_LINK}
  1067. {$IFDEF DYNAMIC_LINK}
  1068. var
  1069.   _HitTestThemeBackground: Pointer;
  1070. function HitTestThemeBackground;
  1071. begin
  1072.   GetProcedureAddress(_HitTestThemeBackground, themelib, 'HitTestThemeBackground');
  1073.   asm
  1074.     mov esp, ebp
  1075.     pop ebp
  1076.     jmp [_HitTestThemeBackground]
  1077.   end;
  1078. end;
  1079. {$ELSE}
  1080. function HitTestThemeBackground; external themelib name 'HitTestThemeBackground';
  1081. {$ENDIF DYNAMIC_LINK}
  1082. {$IFDEF DYNAMIC_LINK}
  1083. var
  1084.   _DrawThemeEdge: Pointer;
  1085. function DrawThemeEdge;
  1086. begin
  1087.   GetProcedureAddress(_DrawThemeEdge, themelib, 'DrawThemeEdge');
  1088.   asm
  1089.     mov esp, ebp
  1090.     pop ebp
  1091.     jmp [_DrawThemeEdge]
  1092.   end;
  1093. end;
  1094. {$ELSE}
  1095. function DrawThemeEdge; external themelib name 'DrawThemeEdge';
  1096. {$ENDIF DYNAMIC_LINK}
  1097. {$IFDEF DYNAMIC_LINK}
  1098. var
  1099.   _DrawThemeIcon: Pointer;
  1100. function DrawThemeIcon;
  1101. begin
  1102.   GetProcedureAddress(_DrawThemeIcon, themelib, 'DrawThemeIcon');
  1103.   asm
  1104.     mov esp, ebp
  1105.     pop ebp
  1106.     jmp [_DrawThemeIcon]
  1107.   end;
  1108. end;
  1109. {$ELSE}
  1110. function DrawThemeIcon; external themelib name 'DrawThemeIcon';
  1111. {$ENDIF DYNAMIC_LINK}
  1112. {$IFDEF DYNAMIC_LINK}
  1113. var
  1114.   _IsThemePartDefined: Pointer;
  1115. function IsThemePartDefined;
  1116. begin
  1117.   GetProcedureAddress(_IsThemePartDefined, themelib, 'IsThemePartDefined');
  1118.   asm
  1119.     mov esp, ebp
  1120.     pop ebp
  1121.     jmp [_IsThemePartDefined]
  1122.   end;
  1123. end;
  1124. {$ELSE}
  1125. function IsThemePartDefined; external themelib name 'IsThemePartDefined';
  1126. {$ENDIF DYNAMIC_LINK}
  1127. {$IFDEF DYNAMIC_LINK}
  1128. var
  1129.   _IsThemeBackgroundPartialTrans: Pointer;
  1130. function IsThemeBackgroundPartiallyTransparent;
  1131. begin
  1132.   GetProcedureAddress(_IsThemeBackgroundPartialTrans, themelib, 'IsThemeBackgroundPartiallyTransparent');
  1133.   asm
  1134.     mov esp, ebp
  1135.     pop ebp
  1136.     jmp [_IsThemeBackgroundPartialTrans]
  1137.   end;
  1138. end;
  1139. {$ELSE}
  1140. function IsThemeBackgroundPartiallyTransparent; external themelib name 'IsThemeBackgroundPartiallyTransparent';
  1141. {$ENDIF DYNAMIC_LINK}
  1142. {$IFDEF DYNAMIC_LINK}
  1143. var
  1144.   _GetThemeColor: Pointer;
  1145. function GetThemeColor;
  1146. begin
  1147.   GetProcedureAddress(_GetThemeColor, themelib, 'GetThemeColor');
  1148.   asm
  1149.     mov esp, ebp
  1150.     pop ebp
  1151.     jmp [_GetThemeColor]
  1152.   end;
  1153. end;
  1154. {$ELSE}
  1155. function GetThemeColor; external themelib name 'GetThemeColor';
  1156. {$ENDIF DYNAMIC_LINK}
  1157. {$IFDEF DYNAMIC_LINK}
  1158. var
  1159.   _GetThemeMetric: Pointer;
  1160. function GetThemeMetric;
  1161. begin
  1162.   GetProcedureAddress(_GetThemeMetric, themelib, 'GetThemeMetric');
  1163.   asm
  1164.     mov esp, ebp
  1165.     pop ebp
  1166.     jmp [_GetThemeMetric]
  1167.   end;
  1168. end;
  1169. {$ELSE}
  1170. function GetThemeMetric; external themelib name 'GetThemeMetric';
  1171. {$ENDIF DYNAMIC_LINK}
  1172. {$IFDEF DYNAMIC_LINK}
  1173. var
  1174.   _GetThemeString: Pointer;
  1175. function GetThemeString;
  1176. begin
  1177.   GetProcedureAddress(_GetThemeString, themelib, 'GetThemeString');
  1178.   asm
  1179.     mov esp, ebp
  1180.     pop ebp
  1181.     jmp [_GetThemeString]
  1182.   end;
  1183. end;
  1184. {$ELSE}
  1185. function GetThemeString; external themelib name 'GetThemeString';
  1186. {$ENDIF DYNAMIC_LINK}
  1187. {$IFDEF DYNAMIC_LINK}
  1188. var
  1189.   _GetThemeBool: Pointer;
  1190. function GetThemeBool;
  1191. begin
  1192.   GetProcedureAddress(_GetThemeBool, themelib, 'GetThemeBool');
  1193.   asm
  1194.     mov esp, ebp
  1195.     pop ebp
  1196.     jmp [_GetThemeBool]
  1197.   end;
  1198. end;
  1199. {$ELSE}
  1200. function GetThemeBool; external themelib name 'GetThemeBool';
  1201. {$ENDIF DYNAMIC_LINK}
  1202. {$IFDEF DYNAMIC_LINK}
  1203. var
  1204.   _GetThemeInt: Pointer;
  1205. function GetThemeInt;
  1206. begin
  1207.   GetProcedureAddress(_GetThemeInt, themelib, 'GetThemeInt');
  1208.   asm
  1209.     mov esp, ebp
  1210.     pop ebp
  1211.     jmp [_GetThemeInt]
  1212.   end;
  1213. end;
  1214. {$ELSE}
  1215. function GetThemeInt; external themelib name 'GetThemeInt';
  1216. {$ENDIF DYNAMIC_LINK}
  1217. {$IFDEF DYNAMIC_LINK}
  1218. var
  1219.   _GetThemeEnumValue: Pointer;
  1220. function GetThemeEnumValue;
  1221. begin
  1222.   GetProcedureAddress(_GetThemeEnumValue, themelib, 'GetThemeEnumValue');
  1223.   asm
  1224.     mov esp, ebp
  1225.     pop ebp
  1226.     jmp [_GetThemeEnumValue]
  1227.   end;
  1228. end;
  1229. {$ELSE}
  1230. function GetThemeEnumValue; external themelib name 'GetThemeEnumValue';
  1231. {$ENDIF DYNAMIC_LINK}
  1232. {$IFDEF DYNAMIC_LINK}
  1233. var
  1234.   _GetThemePosition: Pointer;
  1235. function GetThemePosition;
  1236. begin
  1237.   GetProcedureAddress(_GetThemePosition, themelib, 'GetThemePosition');
  1238.   asm
  1239.     mov esp, ebp
  1240.     pop ebp
  1241.     jmp [_GetThemePosition]
  1242.   end;
  1243. end;
  1244. {$ELSE}
  1245. function GetThemePosition; external themelib name 'GetThemePosition';
  1246. {$ENDIF DYNAMIC_LINK}
  1247. {$IFDEF DYNAMIC_LINK}
  1248. var
  1249.   _GetThemeFont: Pointer;
  1250. function GetThemeFont;
  1251. begin
  1252.   GetProcedureAddress(_GetThemeFont, themelib, 'GetThemeFont');
  1253.   asm
  1254.     mov esp, ebp
  1255.     pop ebp
  1256.     jmp [_GetThemeFont]
  1257.   end;
  1258. end;
  1259. {$ELSE}
  1260. function GetThemeFont; external themelib name 'GetThemeFont';
  1261. {$ENDIF DYNAMIC_LINK}
  1262. {$IFDEF DYNAMIC_LINK}
  1263. var
  1264.   _GetThemeRect: Pointer;
  1265. function GetThemeRect;
  1266. begin
  1267.   GetProcedureAddress(_GetThemeRect, themelib, 'GetThemeRect');
  1268.   asm
  1269.     mov esp, ebp
  1270.     pop ebp
  1271.     jmp [_GetThemeRect]
  1272.   end;
  1273. end;
  1274. {$ELSE}
  1275. function GetThemeRect; external themelib name 'GetThemeRect';
  1276. {$ENDIF DYNAMIC_LINK}
  1277. {$IFDEF DYNAMIC_LINK}
  1278. var
  1279.   _GetThemeMargins: Pointer;
  1280. function GetThemeMargins;
  1281. begin
  1282.   GetProcedureAddress(_GetThemeMargins, themelib, 'GetThemeMargins');
  1283.   asm
  1284.     mov esp, ebp
  1285.     pop ebp
  1286.     jmp [_GetThemeMargins]
  1287.   end;
  1288. end;
  1289. {$ELSE}
  1290. function GetThemeMargins; external themelib name 'GetThemeMargins';
  1291. {$ENDIF DYNAMIC_LINK}
  1292. {$IFDEF DYNAMIC_LINK}
  1293. var
  1294.   _GetThemeIntList: Pointer;
  1295. function GetThemeIntList;
  1296. begin
  1297.   GetProcedureAddress(_GetThemeIntList, themelib, 'GetThemeIntList');
  1298.   asm
  1299.     mov esp, ebp
  1300.     pop ebp
  1301.     jmp [_GetThemeIntList]
  1302.   end;
  1303. end;
  1304. {$ELSE}
  1305. function GetThemeIntList; external themelib name 'GetThemeIntList';
  1306. {$ENDIF DYNAMIC_LINK}
  1307. {$IFDEF DYNAMIC_LINK}
  1308. var
  1309.   _GetThemePropertyOrigin: Pointer;
  1310. function GetThemePropertyOrigin;
  1311. begin
  1312.   GetProcedureAddress(_GetThemePropertyOrigin, themelib, 'GetThemePropertyOrigin');
  1313.   asm
  1314.     mov esp, ebp
  1315.     pop ebp
  1316.     jmp [_GetThemePropertyOrigin]
  1317.   end;
  1318. end;
  1319. {$ELSE}
  1320. function GetThemePropertyOrigin; external themelib name 'GetThemePropertyOrigin';
  1321. {$ENDIF DYNAMIC_LINK}
  1322. {$IFDEF DYNAMIC_LINK}
  1323. var
  1324.   _SetWindowTheme: Pointer;
  1325. function SetWindowTheme;
  1326. begin
  1327.   GetProcedureAddress(_SetWindowTheme, themelib, 'SetWindowTheme');
  1328.   asm
  1329.     mov esp, ebp
  1330.     pop ebp
  1331.     jmp [_SetWindowTheme]
  1332.   end;
  1333. end;
  1334. {$ELSE}
  1335. function SetWindowTheme; external themelib name 'SetWindowTheme';
  1336. {$ENDIF DYNAMIC_LINK}
  1337. {$IFDEF DYNAMIC_LINK}
  1338. var
  1339.   _GetThemeFilename: Pointer;
  1340. function GetThemeFilename;
  1341. begin
  1342.   GetProcedureAddress(_GetThemeFilename, themelib, 'GetThemeFilename');
  1343.   asm
  1344.     mov esp, ebp
  1345.     pop ebp
  1346.     jmp [_GetThemeFilename]
  1347.   end;
  1348. end;
  1349. {$ELSE}
  1350. function GetThemeFilename; external themelib name 'GetThemeFilename';
  1351. {$ENDIF DYNAMIC_LINK}
  1352. {$IFDEF DYNAMIC_LINK}
  1353. var
  1354.   _GetThemeSysColor: Pointer;
  1355. function GetThemeSysColor;
  1356. begin
  1357.   GetProcedureAddress(_GetThemeSysColor, themelib, 'GetThemeSysColor');
  1358.   asm
  1359.     mov esp, ebp
  1360.     pop ebp
  1361.     jmp [_GetThemeSysColor]
  1362.   end;
  1363. end;
  1364. {$ELSE}
  1365. function GetThemeSysColor; external themelib name 'GetThemeSysColor';
  1366. {$ENDIF DYNAMIC_LINK}
  1367. {$IFDEF DYNAMIC_LINK}
  1368. var
  1369.   _GetThemeSysColorBrush: Pointer;
  1370. function GetThemeSysColorBrush;
  1371. begin
  1372.   GetProcedureAddress(_GetThemeSysColorBrush, themelib, 'GetThemeSysColorBrush');
  1373.   asm
  1374.     mov esp, ebp
  1375.     pop ebp
  1376.     jmp [_GetThemeSysColorBrush]
  1377.   end;
  1378. end;
  1379. {$ELSE}
  1380. function GetThemeSysColorBrush; external themelib name 'GetThemeSysColorBrush';
  1381. {$ENDIF DYNAMIC_LINK}
  1382. {$IFDEF DYNAMIC_LINK}
  1383. var
  1384.   _GetThemeSysBool: Pointer;
  1385. function GetThemeSysBool;
  1386. begin
  1387.   GetProcedureAddress(_GetThemeSysBool, themelib, 'GetThemeSysBool');
  1388.   asm
  1389.     mov esp, ebp
  1390.     pop ebp
  1391.     jmp [_GetThemeSysBool]
  1392.   end;
  1393. end;
  1394. {$ELSE}
  1395. function GetThemeSysBool; external themelib name 'GetThemeSysBool';
  1396. {$ENDIF DYNAMIC_LINK}
  1397. {$IFDEF DYNAMIC_LINK}
  1398. var
  1399.   _GetThemeSysSize: Pointer;
  1400. function GetThemeSysSize;
  1401. begin
  1402.   GetProcedureAddress(_GetThemeSysSize, themelib, 'GetThemeSysSize');
  1403.   asm
  1404.     mov esp, ebp
  1405.     pop ebp
  1406.     jmp [_GetThemeSysSize]
  1407.   end;
  1408. end;
  1409. {$ELSE}
  1410. function GetThemeSysSize; external themelib name 'GetThemeSysSize';
  1411. {$ENDIF DYNAMIC_LINK}
  1412. {$IFDEF DYNAMIC_LINK}
  1413. var
  1414.   _GetThemeSysFont: Pointer;
  1415. function GetThemeSysFont;
  1416. begin
  1417.   GetProcedureAddress(_GetThemeSysFont, themelib, 'GetThemeSysFont');
  1418.   asm
  1419.     mov esp, ebp
  1420.     pop ebp
  1421.     jmp [_GetThemeSysFont]
  1422.   end;
  1423. end;
  1424. {$ELSE}
  1425. function GetThemeSysFont; external themelib name 'GetThemeSysFont';
  1426. {$ENDIF DYNAMIC_LINK}
  1427. {$IFDEF DYNAMIC_LINK}
  1428. var
  1429.   _GetThemeSysString: Pointer;
  1430. function GetThemeSysString;
  1431. begin
  1432.   GetProcedureAddress(_GetThemeSysString, themelib, 'GetThemeSysString');
  1433.   asm
  1434.     mov esp, ebp
  1435.     pop ebp
  1436.     jmp [_GetThemeSysString]
  1437.   end;
  1438. end;
  1439. {$ELSE}
  1440. function GetThemeSysString; external themelib name 'GetThemeSysString';
  1441. {$ENDIF DYNAMIC_LINK}
  1442. {$IFDEF DYNAMIC_LINK}
  1443. var
  1444.   _GetThemeSysInt: Pointer;
  1445. function GetThemeSysInt;
  1446. begin
  1447.   GetProcedureAddress(_GetThemeSysInt, themelib, 'GetThemeSysInt');
  1448.   asm
  1449.     mov esp, ebp
  1450.     pop ebp
  1451.     jmp [_GetThemeSysInt]
  1452.   end;
  1453. end;
  1454. {$ELSE}
  1455. function GetThemeSysInt; external themelib name 'GetThemeSysInt';
  1456. {$ENDIF DYNAMIC_LINK}
  1457. {$IFDEF DYNAMIC_LINK}
  1458. var
  1459.   _IsThemeActive: Pointer;
  1460. function IsThemeActive;
  1461. begin
  1462.   GetProcedureAddress(_IsThemeActive, themelib, 'IsThemeActive');
  1463.   asm
  1464.     mov esp, ebp
  1465.     pop ebp
  1466.     jmp [_IsThemeActive]
  1467.   end;
  1468. end;
  1469. {$ELSE}
  1470. function IsThemeActive; external themelib name 'IsThemeActive';
  1471. {$ENDIF DYNAMIC_LINK}
  1472. {$IFDEF DYNAMIC_LINK}
  1473. var
  1474.   _IsAppThemed: Pointer;
  1475. function IsAppThemed;
  1476. begin
  1477.   GetProcedureAddress(_IsAppThemed, themelib, 'IsAppThemed');
  1478.   asm
  1479.     mov esp, ebp
  1480.     pop ebp
  1481.     jmp [_IsAppThemed]
  1482.   end;
  1483. end;
  1484. {$ELSE}
  1485. function IsAppThemed; external themelib name 'IsAppThemed';
  1486. {$ENDIF DYNAMIC_LINK}
  1487. {$IFDEF DYNAMIC_LINK}
  1488. var
  1489.   _GetWindowTheme: Pointer;
  1490. function GetWindowTheme;
  1491. begin
  1492.   GetProcedureAddress(_GetWindowTheme, themelib, 'GetWindowTheme');
  1493.   asm
  1494.     mov esp, ebp
  1495.     pop ebp
  1496.     jmp [_GetWindowTheme]
  1497.   end;
  1498. end;
  1499. {$ELSE}
  1500. function GetWindowTheme; external themelib name 'GetWindowTheme';
  1501. {$ENDIF DYNAMIC_LINK}
  1502. {$IFDEF DYNAMIC_LINK}
  1503. var
  1504.   _EnableThemeDialogTexture: Pointer;
  1505. function EnableThemeDialogTexture;
  1506. begin
  1507.   GetProcedureAddress(_EnableThemeDialogTexture, themelib, 'EnableThemeDialogTexture');
  1508.   asm
  1509.     mov esp, ebp
  1510.     pop ebp
  1511.     jmp [_EnableThemeDialogTexture]
  1512.   end;
  1513. end;
  1514. {$ELSE}
  1515. function EnableThemeDialogTexture; external themelib name 'EnableThemeDialogTexture';
  1516. {$ENDIF DYNAMIC_LINK}
  1517. {$IFDEF DYNAMIC_LINK}
  1518. var
  1519.   _IsThemeDialogTextureEnabled: Pointer;
  1520. function IsThemeDialogTextureEnabled;
  1521. begin
  1522.   GetProcedureAddress(_IsThemeDialogTextureEnabled, themelib, 'IsThemeDialogTextureEnabled');
  1523.   asm
  1524.     mov esp, ebp
  1525.     pop ebp
  1526.     jmp [_IsThemeDialogTextureEnabled]
  1527.   end;
  1528. end;
  1529. {$ELSE}
  1530. function IsThemeDialogTextureEnabled; external themelib name 'IsThemeDialogTextureEnabled';
  1531. {$ENDIF DYNAMIC_LINK}
  1532. {$IFDEF DYNAMIC_LINK}
  1533. var
  1534.   _GetThemeAppProperties: Pointer;
  1535. function GetThemeAppProperties;
  1536. begin
  1537.   GetProcedureAddress(_GetThemeAppProperties, themelib, 'GetThemeAppProperties');
  1538.   asm
  1539.     mov esp, ebp
  1540.     pop ebp
  1541.     jmp [_GetThemeAppProperties]
  1542.   end;
  1543. end;
  1544. {$ELSE}
  1545. function GetThemeAppProperties; external themelib name 'GetThemeAppProperties';
  1546. {$ENDIF DYNAMIC_LINK}
  1547. {$IFDEF DYNAMIC_LINK}
  1548. var
  1549.   _SetThemeAppProperties: Pointer;
  1550. procedure SetThemeAppProperties;
  1551. begin
  1552.   GetProcedureAddress(_SetThemeAppProperties, themelib, 'SetThemeAppProperties');
  1553.   asm
  1554.     mov esp, ebp
  1555.     pop ebp
  1556.     jmp [_SetThemeAppProperties]
  1557.   end;
  1558. end;
  1559. {$ELSE}
  1560. procedure SetThemeAppProperties; external themelib name 'SetThemeAppProperties';
  1561. {$ENDIF DYNAMIC_LINK}
  1562. {$IFDEF DYNAMIC_LINK}
  1563. var
  1564.   _GetCurrentThemeName: Pointer;
  1565. function GetCurrentThemeName;
  1566. begin
  1567.   GetProcedureAddress(_GetCurrentThemeName, themelib, 'GetCurrentThemeName');
  1568.   asm
  1569.     mov esp, ebp
  1570.     pop ebp
  1571.     jmp [_GetCurrentThemeName]
  1572.   end;
  1573. end;
  1574. {$ELSE}
  1575. function GetCurrentThemeName; external themelib name 'GetCurrentThemeName';
  1576. {$ENDIF DYNAMIC_LINK}
  1577. {$IFDEF DYNAMIC_LINK}
  1578. var
  1579.   _GetThemeDocumentationProperty: Pointer;
  1580. function GetThemeDocumentationProperty;
  1581. begin
  1582.   GetProcedureAddress(_GetThemeDocumentationProperty, themelib, 'GetThemeDocumentationProperty');
  1583.   asm
  1584.     mov esp, ebp
  1585.     pop ebp
  1586.     jmp [_GetThemeDocumentationProperty]
  1587.   end;
  1588. end;
  1589. {$ELSE}
  1590. function GetThemeDocumentationProperty; external themelib name 'GetThemeDocumentationProperty';
  1591. {$ENDIF DYNAMIC_LINK}
  1592. {$IFDEF DYNAMIC_LINK}
  1593. var
  1594.   _DrawThemeParentBackground: Pointer;
  1595. function DrawThemeParentBackground;
  1596. begin
  1597.   GetProcedureAddress(_DrawThemeParentBackground, themelib, 'DrawThemeParentBackground');
  1598.   asm
  1599.     mov esp, ebp
  1600.     pop ebp
  1601.     jmp [_DrawThemeParentBackground]
  1602.   end;
  1603. end;
  1604. {$ELSE}
  1605. function DrawThemeParentBackground; external themelib name 'DrawThemeParentBackground';
  1606. {$ENDIF DYNAMIC_LINK}
  1607. {$IFDEF DYNAMIC_LINK}
  1608. var
  1609.   _EnableTheming: Pointer;
  1610. function EnableTheming;
  1611. begin
  1612.   GetProcedureAddress(_EnableTheming, themelib, 'EnableTheming');
  1613.   asm
  1614.     mov esp, ebp
  1615.     pop ebp
  1616.     jmp [_EnableTheming]
  1617.   end;
  1618. end;
  1619. {$ELSE}
  1620. function EnableTheming; external themelib name 'EnableTheming';
  1621. {$ENDIF DYNAMIC_LINK}
  1622. end.