Einzelnen Beitrag anzeigen

MathiasSimmack
(Gast)

n/a Beiträge
 
#15

Re: [NonVCL] Hintergundfarbe des TabSheets mit XP-Styles

  Alt 27. Sep 2006, 16:44
Zitat von Daniel Schuhmann:
(Nur mit aktivierten Themes und ohne Manifest schaut's komisch aus, aber das macht ja keiner).
Wie wäre folgende "Notlösung"?
Delphi-Quellcode:
function IsManifestAvailable(const FileName: string): boolean;
const
  RT_MANIFEST = MAKEINTRESOURCE(24);

  function ManifestProc(module: HMODULE; lpszType: PAnsiChar;
    lp: LPARAM): bool; stdcall;
  begin
    Result := not(lpszType = RT_MANIFEST);
  end;

var
  module : HINST;
begin
  Result := false;

  // the file does not exist
  if not fileexists(FileName) then exit;

  // this is not Windows XP or newer
  if not IsWindowsXp then exit;
  // ERSETZEN DURCH EIGENE PRÜFROUTINE, OB XP ODER HÖHER!!!

  // is there a regular .manifest file?
  Result := fileexists(FileName + '.manifest');

  // is there a manifest resource?
  if not Result then
  begin
    module := LoadLibrary(pchar(FileName));
    if module <> 0 then
      Result := not EnumResourceTypes(module, @ManifestProc, 0);
  end;
end;
Anzuwenden (um bei deinem Beispiel zu bleiben):
Delphi-Quellcode:
For I := 0 to Length(hTabDlgs) -1 do
  begin
    hTabDlgs[I] := CreateDialog(hInstance,
      MAKEINTRESOURCE(200 + I), hDlg, @tabDlgFunc);

    if IsManifestAvailable(paramstr(0)) then
      LoadThemeDLL(hTabDlgs[i], ETDT_ENABLETAB);
  end;
  Mit Zitat antworten Zitat