{==============================================================================

  CustomForm Control
  Copyright (C) 2000-2001 by Evgeny Kryukov
  All rights reserved

  All contents of this file and all other files included in this archive
  are Copyright (C) 2001 Evgeny Kryukov. Use and/or distribution of
  them requires acceptance of the License Agreement.

  See License.txt for licence information

===============================================================================}

unit KsWinXP;

{$I KsCommonVer.Inc}

interface

uses
  Windows;

function IsThemeAvailable: boolean;

implementation {===============================================================}

const
  themelib = 'uxtheme.dll';


var
  UxThemeLib: THandle;
  IsAppThemed: function : BOOL; stdcall;

procedure InitXPTheme;
begin
  UxThemeLib := LoadLibrary(ThemeLib);
  if UxThemeLib <> 0 then
    @IsAppThemed := GetProcAddress(UxThemeLib, 'IsAppThemed');
end;

procedure FreeXPTheme;
begin
  if UxThemeLib <> 0 then
    FreeLibrary(UxThemeLib);
end;

function IsThemeAvailable: boolean;
begin
  if @IsAppThemed <> nil then
    Result := IsAppThemed
  else
    Result := false;
end;

initialization
  InitXPTheme;
finalization
  FreeXPTheme;
end.
