Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 07-14-2009, 05:37 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default Vista Themes.

Hi,

I have an old application (without source code). When I run it under Windows Vista it does not use Vista themes. How can I make it use Vista themes? I know about Windows APIs for themes (SetWindowTheme-EnableThemeDialogTexture..Etc) in the UxTheme unit but can not figure out how to use it!!! Any suggestions?
Reply With Quote
  #2  
Old 07-14-2009, 06:58 PM
nester261 nester261 is offline
Moderator
 
Join Date: Jan 2004
Location: UK
Posts: 618
Default

If you do not have the source it makes things harder but I have just tried on an old Delphi project of mine without themes.

In a Hex editor such as Hiew I tried inserting the manifest and had partial sucess in that some controls became vista themed but the buttons did not.

I think the newest version of PE Explorer can do this - see here: http://www.heaventools.com/PE_Explor..._XP_Wizard.htm

Nester261
__________________
"Where there's a will, there's always a way."

-- The Hon Robert Nester Marley O.M. - aka Bob Marley!
Reply With Quote
  #3  
Old 07-14-2009, 07:39 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default

Thanks Nester261,

But I want to do that using API's, I was able to use "SetWindowTheme(self.Handle,nil,'');" to disable the theme under Vista. Therefore I know for sure that it can be done using the same API. But I can not figure out what to pass in the third parameter!!!
Reply With Quote
  #4  
Old 07-14-2009, 10:28 PM
nester261 nester261 is offline
Moderator
 
Join Date: Jan 2004
Location: UK
Posts: 618
Default

This should set the style back:

Code:
procedure SetStyle(const AHandle: THandle);
begin
  SetWindowTheme(AHandle, 'Style', nil);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  SetStyle(self.Handle);
end;
__________________
"Where there's a will, there's always a way."

-- The Hon Robert Nester Marley O.M. - aka Bob Marley!
Reply With Quote
  #5  
Old 07-15-2009, 01:31 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default

Nester261,

You are giving me a hard time. Right now at this moment I just begin to think that I'm old or getting old to play again With Windows APIs!!! However, what you suggested can only apply to forms and not with the VCL components. Of course I have to tell you that I know about VCL native components which really not native to Windows. Therefore, you have to tell me another story that I missed. Last but not least, big thanks to you Nester261
Reply With Quote
  #6  
Old 07-15-2009, 05:48 AM
nester261 nester261 is offline
Moderator
 
Join Date: Jan 2004
Location: UK
Posts: 618
Default

To do the same for a VCL Control you can just use it's handle:

Code:
 SetStyle(Button2.Handle);
If you could enumerate through all the component names on the Form then set them all to the Vista style that way, maybe using a TStringList to hold the names?
__________________
"Where there's a will, there's always a way."

-- The Hon Robert Nester Marley O.M. - aka Bob Marley!
Reply With Quote
  #7  
Old 07-17-2009, 03:58 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default

In which unit "SetStyle" function exists? I get a compiling error.
Reply With Quote
  #8  
Old 07-17-2009, 04:05 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default

Please ignore my previous post.
Reply With Quote
  #9  
Old 07-17-2009, 04:06 PM
nester261 nester261 is offline
Moderator
 
Join Date: Jan 2004
Location: UK
Posts: 618
Default

Hi,

Sorry I meant for you to use it from the procedure:

Code:
procedure SetStyle(const AHandle: THandle);
begin
  SetWindowTheme(AHandle, 'Style', nil);
end;
Then you can set any control to Vista style by using the controls handle:

Code:
SetStyle(Button2.Handle);
__________________
"Where there's a will, there's always a way."

-- The Hon Robert Nester Marley O.M. - aka Bob Marley!
Reply With Quote
  #10  
Old 07-17-2009, 04:07 PM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,335
Default

This is a function he gave you a few posts above ;-)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:29 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.