?
Solved

Change XP Theme...

Posted on 2004-10-18
4
Medium Priority
?
1,906 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-
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

752 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