Solved

Change XP Theme...

Posted on 2004-10-18
4
1,881 Views
Last Modified: 2009-06-27
Hello,

How can I change the theme using delphi

E.g
User is using XP Luna Style (Blue one)
change it to the Old Windows Style

Thanks Alan.
0
Comment
Question by:-Karamja-
4 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 500 total points
ID: 12375152
Alan,

You should be able to do this fairly easily using the ThemeUI ActiveX library. Just remember to include the ComObj and ActiveX units in the "uses" clause of the project.

Sample:

procedure TForm1.Button1Click(Sender: TObject);
var  oThemeManager: Variant;
     oTheme:        Variant;
     dwThemes:      Integer;
     dwTheme:       Integer;
begin

  // Create an instance of the theme manager
  oThemeManager:=CreateOleObject('Theme.Manager');

  // Resource protection
  try
     // Get the count of themes
     dwThemes:=Pred(Integer(oThemeManager.Length));
     // Walk the items looking for the classic style
     for dwTheme:=0 to dwThemes do
     begin
        // Get the theme
        oTheme:=oThemeManager.Item[dwTheme];
        try
           // Check the theme name
           if (CompareText(String(oTheme.DisplayName), 'Windows Classic') = 0) then
           begin
              // Set the theme
             oThemeManager.SelectedTheme:=oTheme;
              // Apply the theme
              oThemeManager.ApplyNow;
              // Done
              break;
           end;
        finally
           // Release the theme IDispatch
           oTheme:=Unassigned;
        end;
     end;
  finally
     // Release the theme manager IDispatch interface
     oThemeManager:=Unassigned;
  end;

end;

----

Regards,
Russell
0
 
LVL 2

Author Comment

by:-Karamja-
ID: 12375335
Thanks :)
0
 

Expert Comment

by:vikrant_kpr
ID: 20157734
Hy Friends

  Will the above code work simply with delphi installation or some library is needed for the above code to work?
I am trying to implement the same in c++ ,
even if above works it would help in finding out the way for c++
or i can try to use the same in my project?

Regards
0
 

Expert Comment

by:AgentAmine
ID: 24731723
hi, the code is not working, it says "Access denied", i think the themui in sp2 have some kind of security, but the one in sp1 dont have. how can i use the sp1 dll (i copy from the sp1 cd) with this delphi code. any help will be appreciated.
thnks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now