Page 1 of 1

2007 style question

PostPosted: Tue Dec 04, 2007 8:52 am
by Dietmar Jahnel
Is there a way to check if someone uses "classical windows" desighn in XP or Vista ?
IsAppThemed() still returns .T.
In this case menu and messagebar are 2007 style, dialogs look "old" which gives a strange look in that combination.

Regards,
Dietmar

PostPosted: Tue Dec 04, 2007 10:33 am
by Antonio Linares
Dietmar,

> IsAppThemed() still returns .T.

IsAppThemed() just checks is the themes manifest file is included in the EXE

We need to find a way to detect if the user has the classic look

PostPosted: Tue Dec 04, 2007 1:14 pm
by Dietmar Jahnel
We need to find a way to detect if the user has the classic look

That's what I was looking for :) !

Hope you can find a way!

Regards,
Dietmar

PostPosted: Tue Dec 04, 2007 3:14 pm
by Antonio Linares
Dietmar,

Google is our friend :-)

>
One possibility would be to check the value of ThemeActive in the registry under: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager

I believe a value of 0 means that no themes are in use (Windows Classic Style) and a value of 1 means that themes are in use (Windows XP style).
>

PostPosted: Tue Dec 04, 2007 3:18 pm
by Antonio Linares
Dietmar,

More results :-)
>
Call OpenThemeData. This will return a handle to the theme, which, if NULL indicates that the visual style manager is disabled or there is no information for that control, which means that you should continue to draw using your default routines.
>

PostPosted: Tue Dec 04, 2007 4:22 pm
by James Bott
Antonio,

>Call OpenThemeData

Is that an existing FW or Harbour function, or is it an API?

James

PostPosted: Tue Dec 04, 2007 4:48 pm
by Dietmar Jahnel
>Call OpenThemeData

Antonio,
could you please post the code to do that.
We are about to release a new version of our software...

Thanks,
Dietmar

PostPosted: Tue Dec 04, 2007 10:46 pm
by Enrico Maria Giordano
James Bott wrote:Is that an existing FW or Harbour function, or is it an API?


It's an API:

Code: Select all  Expand view
HTHEME OpenThemeData( HWND hwnd, LPCWSTR pszClassList );


EMG

PostPosted: Tue Dec 04, 2007 11:59 pm
by Antonio Linares
Dietmar,

Here you have a working sample:
Code: Select all  Expand view
function Main()

   MsgInfo( IsThemeActive() )

return nil

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

typedef BOOL ( * PFISTHEMEACTIVE ) ( void );

HB_FUNC( ISTHEMEACTIVE )
{
   HINSTANCE hDLL = LoadLibrary( "UxTheme.dll" );
   PFISTHEMEACTIVE IsThemeActive;
   
   if( hDLL == NULL )
   {
      hb_retl( FALSE );
      return;
   }
   else
      IsThemeActive = ( void * ) GetProcAddress( hDLL, "IsThemeActive" );
     
   if( IsThemeActive )
      hb_retl( IsThemeActive() );
   else
      hb_retl( FALSE );   
   
   FreeLibrary( hDLL );
}   
   
#pragma ENDDUMP

PostPosted: Thu Dec 06, 2007 3:53 pm
by Dietmar Jahnel
nice - that's it!

But I noticed that there seems to be a little painting problem with bars without themes. Right of the bitmaps there is a darker grey...

I send the image to your per mail

Regards,
Dietmar

PostPosted: Thu Dec 06, 2007 5:26 pm
by Antonio Linares
Dietmar,

If you don't use the 2007 clause then you have to use the 3D clause to get the colors and painting that you want :-)

PostPosted: Thu Dec 06, 2007 6:27 pm
by Dietmar Jahnel
Many Thanks, now the look is consistent with and without themes! :D
Dietmar