Entwickler-Ecke

Windows API - WIndows XP : Xp Styles aktiviert?


Moritz M. - Fr 25.04.03 14:44
Titel: WIndows XP : Xp Styles aktiviert?
Hi

Wie kann man herausfinden, ob unter XP die Virtuellen Styles aktiviert sind?


Delete - Fr 25.04.03 15:49

Virtuell? Ich nehme mal an, du meinst visuell. Dann lautet die Antwort: Ja. Es gibt eine eigene Funktion dafür:

Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
type
  TIsThemeActive = function: bool; stdcall;

var
  IsThemeActive  : TIsThemeActive;
  xpthemedll     : dword = 0;

begin
  xpthemedll := GetModuleHandle('uxtheme.dll');
  if(xpthemedll = 0) then xpthemedll := LoadLibrary('uxtheme.dll');

  if(xpthemedll <> 0) then begin
    @IsThemeActive := GetProcAddress(xpthemedll,'IsThemeActive');

    if(@IsThemeActive = nil) then begin
      FreeLibrary(xpthemedll);
      xpthemedll := 0;
    end;
  end;
end;

Du solltest vor dem Laden prüfen, ob dein Programm unter XP läuft. Und es empfiehlt sich vor dem Aufruf der Funktion auch noch mal zu prüfen, ob das DLL-Handle (xpthemedll) ungleich Null bzw. die Funktion (IsThemeActive) ungleich nil ist.

Gruß.


Moritz M. - Fr 25.04.03 15:51

Ja, sorry, meinte Visuell.

Danke.
Geht.