whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

48 Visitors Online


 
...get the name of the current visual style, the color scheme name and size name (XP)?
Autor: David B. Ferguson
[ Print tip ]  

Tip Rating (4):  
     


uses ComObj, SyncObjs;

var
  
GetCurrentThemeName: function (pszThemeFileName: LPWSTR; cchMaxNameChars: Integer;
    pszColorBuff: LPWSTR; cchMaxColorChars: Integer; pszSizeBuff: LPWSTR;
    cchMaxSizeChars: Integer): HRESULT; stdcall;

procedure TForm1.Button1Click(Sender: TObject);
var
  
FileName, ColorScheme, SizeName: WideString;
  hThemeLib: THandle;
begin
  try
    
hThemeLib := LoadLibrary('uxtheme.dll');
    if hThemeLib > 0 then
      
GetCurrentThemeName := GetProcAddress(hThemeLib, 'GetCurrentThemeName');
    if Assigned(GetCurrentThemeName) then
    begin
      
SetLength(FileName, 255);
      SetLength(ColorScheme, 255);
      SetLength(SizeName, 255);
      OleCheck(GetCurrentThemeName(PWideChar(FileName), 255,
        PWideChar(ColorScheme), 255, PWideChar(SizeName), 255));
      // show the the theme path and file name.
      
ShowMessage(PWideChar(FileName));
      // show the color scheme name
      
ShowMessage(PWideChar(ColorScheme));
      // show the size name
      
ShowMessage(PWideChar(SizeName));
    end;
  finally
    
FreeLibrary(hThemeLib);
  end;
end;


 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners