Solved

Change XP Theme...

Posted on 2004-10-18
4
1,885 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 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

21 Experts available now in Live!

Get 1:1 Help Now