?
Solved

Change XP Theme...

Posted on 2004-10-18
4
Medium Priority
?
1,922 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline
Suggested Courses

840 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