Announcement

Collapse
No announcement yet.

How to implement Windows XP Visual Styles/Themes with DDT Dialogs ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to implement Windows XP Visual Styles/Themes with DDT Dialogs ?

    I´m familiar with many Windows topics and programming concepts,
    but XP Visual Styles is new to me.

    Normally reading SDK Documentation for a new topic supplies enough
    information to get along with - not in this case. I don´t fully
    understand the concept and necessary steps.

    Ok, you have to specify a manifest for Common Controls to work with
    Visual Styles. There is a set of api functions managing Visual Styles
    (e.g. SetWndowTheme) but i couldn´t figure out, how to get this
    really working.

    For a start i tried several working DDT and SDK applications with various
    common controls (nothing special in there like ownerdraw or customdraw)
    but wasn´t successful at all.

    Is there a generic way to implement Visual Styles for the whole app
    or do i have to specify it for each and every window (or class) used
    in my app. ? How to switch between different styles ? What about
    ownerdrawn and customdrawn controls ?

    My final goal is to adapt the visual style of an extension, i developped
    for my personal use, for an existing commercial app using visual styles.


    Maybe someone out there knows the answers or can supply hints or
    sample code in Basic or C.


    Thanks in advance


    Guenther

  • #2
    You don't have to do anything except add the "themes manifest" resource to the program. Windows will then treat the app as if it was themed*. Here is a post I made on the subject a few years back...

    http://www.powerbasic.com/support/pb...ad.php?t=24108

    *One exception: if you are using tab controls then you'd need to call EnableDialogTheme with each child page which will then blend the dialog color with the background tab page. The code I linked to shows an example of EnableDialogTheme.
    Last edited by Kev Peel; 8 Feb 2008, 06:39 PM.
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      Kev,

      many thanks for your quick reply !

      1 24 "mytheme.xml" in resource was the missing part.

      As a first step this works. But what about adapting my app to the look of another.
      I have several third party apps running on my machine with different looks, one of
      these apps offers an options tab, where you can choose 5 different looks.
      I want my app to look exactly the same as this app currently does. Meaning my app
      first has to find out, which of these 5 looks is currently active (the other app is
      running and i can supply handles, names, process id - whatever you want) and then apply
      this look to itself dynamically. Could this be done and - if yes - how ?

      I still don´t understand the concept behind all this, where to find better and deeper information than in SDK ?


      Guenther

      Comment


      • #4
        Guenther,

        I have no idea, it sounds like the application is using it's own skinning engine. Windows themes, as far as I know, are only selectable by the user in Windows' control panel, which Windows then uses with each theme-enabled app.

        If you post some screen shots or more information about these "themed" apps, we may be able to find out how the look is achieved. Patrice Terrier, who posts here occasionally, actually has an "skinning" tool for purchase, more details here:

        http://www.zapsolution.com/winlift/index.htm
        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

        Comment


        • #5
          Kev,

          thanks again !

          This app uses standart windows common controls with standart shape, but the colors
          differ, the backgrounds seem to have a texture, the color of the caption and menu
          has changed. For instance the default button is not only surrounded by an orange
          frame (standart xp blue, orange, if mouse points to it) but its background is
          orange. Therefore i don´t think it is using a skinning engine. Colors, background
          and state specific appearance are different - nothing else. Furthermore i know this
          app is written in VC++ by a microsoft certified partner company, i´m pretty sure
          they use some kind of microsoft stuff to get this look.

          You can do similar things in control panel but these changes apply to all apps on
          your machine and not only to a specific one.

          As far as i understand these things now, a theme aplies to all apps on your machine
          because colors, sounds, cursors and so on are changed in general, when activating a
          new theme. There is no need to enable a theme for a specific app and there is no way
          to disable it either. Maybe i´m wrong here.

          You need a manifest to enable xp visual styles for a specific app as i have learned
          no manifest - no xp look.

          xp visual styles (plural) inplies there is more than one style. how many are there,
          how do they look, and how are these styles choosen ? Maybe i´m wrong here again

          My current working theory is: this app uses some kind of predefined style info
          maybe provided by microsoft [xp visual styles], maybe by the programs authors[themes])
          which is then applied using some microsoft mechanism (theming api ?) to get this
          look. If so it could be copied.

          My next step would be to find out what can be done with themeing and xp visual styles
          and how. then i possibly can decide this is done somehow this way or not. The whole
          thing is not really important - not a matter of life or death - it is a matter of
          curiosity. My app does what it is expected to do, but compared to the other one
          it looks poor, and i wonder, how they did it.

          Guenther

          Comment


          • #6
            Created PBR, but no longer get message box?

            'How do you work with XP themes?
            'Is the code below correct? Created the PBR, but no longer get a message box.
            'Second, does this work with PbForms?
            Code:
              #DIM ALL
              #COMPILE EXE
              #RESOURCE "mytheme.pbr"
              FUNCTION PBMAIN AS LONG
                MSGBOX "What happened to the message box?"
              END FUNCTION
            
            'MyTheme.Rc is this one line
            '1 24 "mytheme.xml"
            '-----------------------------------------------------------------------------
            'MyTheme.Xml
            '  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
            '<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
            '  <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="CompanyName.ProductName.Description" type="win32"/>
            '  <description>Your Application Description Here!</description>
            '  <dependency>
            '    <dependentAssembly>
            '      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
            '    </dependentAssembly>
            '  </dependency>
            '</assembly>
            How long is an idea? Write it down.

            Comment


            • #7
              From the above link:

              You must call InitCommonControls or InitCommonControlsEx in every application that uses XP themes. MSDN states that new controls are stored in this DLL.
              kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

              Comment


              • #8
                Thanks!
                Is the message box supposed to look different, now?

                Code:
                 
                #DIM ALL
                  #COMPILE EXE
                  #INCLUDE "commctrl.inc"
                  #RESOURCE "mytheme.pbr"
                  FUNCTION PBMAIN AS LONG
                    CALL InitCommonControls
                    MSGBOX "What happened to the message box?"
                  END FUNCTION
                How long is an idea? Write it down.

                Comment


                • #9
                  Depends on the theme in use. With the standard theme on a simple message box, only the button(s) will look different.
                  kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

                  Comment


                  • #10
                    Thanks, I'll look for docs on this.
                    How long is an idea? Write it down.

                    Comment


                    • #11
                      You must call InitCommonControls or InitCommonControlsEx in every application that uses XP themes.
                      This was true of PB/Win8. It is no longer true of PB/Win9.
                      - LJ

                      Comment

                      Working...
                      X