[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Change XP Theme...

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

Independent Software Vendors: 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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

656 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