forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Determine XP/Vista classic or themed?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Jul 07, 2009 6:11 pm    Post subject: Determine XP/Vista classic or themed? Reply with quote

Does anyone know if it's possible to find out if XP and Vista are using classic style or a themed style, such as the XP Blue, Silver or Olive style, or Vista Basic or Aero styles?

I kind of browsed around the Vista registry, but haven't found anything yet that would give me any indication of this.

Thanks,
~Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Jul 07, 2009 9:20 pm    Post subject: Reply with quote

Garrett,
Ok below is code to determine the theme being used with XP. I am not sure how to detemine if Aero is being used under Vista. You can try the code below.

Code:

#--------------------------------------------------------------------------------#
#                                                                                #
# Description: Gets information about the XP Theme that is in use.               #
#                                                                                #
# Author: Johnny Kinsey                                                          #
#                                                                                #
# Copyright © 2009 DragonSphere Software All Rights Reserved.                    #
#                                                                                #
#--------------------------------------------------------------------------------#
#DEFINE FUNCTION,GETXPTHEMEINFO,WIDECHARTOSTRING,IsAeroEnabled

# N = Name
# C = Color scheme
# S = Name of the Size option
#
# defaults to N if no parameter specified
#
# Sets @OK() to false if not found.
%A = @GetXPThemeInfo(NCS)
Info %A@CR()

%B = @IsAeroEnabled()
Info %B@CR()
stop

:GetXPThemeInfo
  %R =
  If @Greater(@sysinfo(WINVER),5)
     %I = %1
    LoadLib uxtheme.dll
    %N = @fill(512,,Z)
    %C = @fill(512,,Z)
    %S = @fill(512,,Z)
    %H = @lib(uxtheme,GetCurrentThemeName,INT,INT:@ADDR("%N"),INT:256,INT:@ADDR("%C"),INT:256,INT:@ADDR("%S"),INT:256)
    If @Zero(%H)
       If %I
          %%cnt1 = 1
          %%count = @succ(@len(%I))
          Repeat
            %j = @substr(%I,%%cnt1,%%cnt1)
             If @Equal(%j,N)
               If %R
                  %R = %R@fsep()@WideChartoString(%N,512)
                Else
                  %R = @WideChartoString(%N,512)
                End
             ElsIf @Equal(%j,C)
               If %R
                  %R = %R@fsep()@WideChartoString(%C,512)
                Else
                  %R = @WideChartoString(%C,512)
                End
             Elsif @Equal(%j,S)
               If %R
                  %R = %R@fsep()@WideChartoString(%S,512)
                Else
                  %R = @WideChartoString(%S,512)
                End
             Else
               error 13
             End
             %%cnt1 = @succ(%%cnt1)
          Until @Equal(%%cnt1,%%count)
       Else
         %R = @WideChartoString(%N,512)
       End
     Else
       error -1
     End
     FreeLib uxtheme.dll
   Else
     # Invalid OS version
     error 47
   End
Exit %R

:IsAeroEnabled
  %R =
  If @Greater(@name(@sysinfo(WINVER)),5)
     LoadLib dwmapi.dll
     %E = @binary(DWORD,0)
     %H = @lib(dwmapi,DwmIsCompositionEnabled,INT,INT:@Addr("%E"))
     If @Zero(%H)
       %E = @Val(@substr(%E,1,4))
        If @unequal(%E,0)
          %R = 1
        End
     Else
       error -1
     End
     FreeLib dwmapi
   Else
     # Invalid OS version
     error 47
   End
Exit %R

:WideChartoString
  Rem This sub routine attempts to convert a Wide Character string to a
  rem ASCII character string.
  rem Wide Charater strings are used for non ASCII codepages
  rem
  %Q = %1
  rem Add the number of charaters to traverse
  %%cnt2 = %2
  %%MyString =
  rem Set the starting character
  %%cnt = 1
  rem Loop through the charaters and only return the ASCII charaters
  repeat
    Rem Read each byte and convert it to a character
      %V = @SubStr(%Q,%%cnt)
      if %V
       %%MyString = %%MyString%V
      End
         %U = @Substr(%Q,%%cnt,@succ(%%cnt))
         If @Equal(%U,@chr(0)@chr(0))
        %%cnt = %%cnt2         
         End
      %%cnt = @Succ(%%cnt)     
  Until @Greater(%%cnt,%%cnt2)
  Rem Return our string
Exit %%MyString


Updated: to include a function to determine if Aero is enabled. I have not tested it so let me know if it works.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Jul 08, 2009 12:10 am    Post subject: Reply with quote

DragonSphere, thanks a bunch, I'll give it a whirl.. though I can't test for Aero myself... My so called "Windows Vista Capable" computer can't handle Aero at all and Vista won't even think of letting me have access to Aero Sad
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed Jul 08, 2009 12:53 am    Post subject: Reply with quote

I have tested these 2 functions on my Windows Vista Home and yes the IsAeroEnabled will return VDS null (ie.. empty string) if Aero Glass is off and 1 if Aero Glass is on. The GetXPThemeInfo function returns the expected values in Vista and XP. Enjoy Wink
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Jul 08, 2009 4:06 pm    Post subject: Reply with quote

Sweeeeeeet.. Thanks a bunch Smile
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group