Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

XP Themes Support

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

  • XP Themes Support

    i thought this would be a good place to post information on including xp 'themes' in your application...

    save the following code to an xml file and include in a resource file using resource type 1 and resource identifier 24, ie:

    1 24 "mytheme.xml"

    nb: you must change the "companyname.productname.yourapp" and "your application description here." to the correct values

    Code:
    <?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.yourapp" type="win32"/>
    <description>your application description here.</description>
    <dependency>
    <dependentassembly>
    <assemblyidentitytype="win32" name="microsoft.windows.common-controls"
    version="6.0.0.0" processorarchitecture="x86" publickeytoken="6595b64144ccf1df"
    language="*" />
    </dependentassembly>
    </dependency>
    </assembly>
    don't forget to register tabbed dialogs for theme support using the following function...

    Code:
    #if not %def(%xpthemes)
        %xpthemes           = 1
        %etdt_enable        = &h02
        %etdt_enabletab     = &h06
        %etdt_usetabtexture = &h04
        %etdt_disable       = &h01
        declare function enabledialogtheme(byval hdlg as dword, byval dwstyle as dword) as long
        function enabledialogtheme(byval hdlg as dword, byval dwstyle as dword) as long
            local hmod as dword, hfunc as dword, nret as long
            hmod = loadlibrary("uxtheme.dll")
            if hmod then
               hfunc = getprocaddress(hmod, "enablethemedialogtexture")
               if hfunc then
                  call dword hfunc using enabledialogtheme(hdlg, dwstyle) to nret
                  function = nret
               end if
               freelibrary hmod
            end if
        end function
    #endif

    borje posted a function to check for theme support here...
    http://www.powerbasic.com/support/pb...ad.php?t=23944

    ------------------
    kev peel
    http://www.kgpsoftware.com

    [this message has been edited by kev peel (edited december 18, 2003).]
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

  • #2
    Quick Notes...

    Using controls

    You must call InitCommonControls or InitCommonControlsEx in every application that uses XP themes. MSDN states that new controls are stored in this DLL.


    Adding to already compiled applications

    You can add theme support to any existing win32 program by simply creating the .xml file as "exename.exe.manifest", where "exename.exe" is the program's name. Place it in the program's folder. I did this with Visual Studio 6 and it worked fine.

    ------------------
    Kev Peel
    http://www.kgpsoftware.com

    [This message has been edited by Kev Peel (edited December 26, 2003).]
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      Code imported from old forum incorrectly. Here is a fix for the EnableDialogTheme function, with the correct capitalization:

      Code:
      #If Not %Def(%XPTHEMES)
          %XPTHEMES           = 1
          %ETDT_ENABLE        = &h02
          %ETDT_ENABLETAB     = &h06
          %ETDT_USETABTEXTURE = &h04
          %ETDT_DISABLE       = &h01
          Declare Function EnableDialogTheme(ByVal hDlg As Dword, ByVal dwStyle As Dword) As Long
          Function EnableDialogTheme(ByVal hDlg As Dword, ByVal dwStyle As Dword) As Long
              Local hMod As Dword, hFunc As Dword, nRet As Long
              hMod = LoadLibrary("UXTHEME.DLL")
              If hMod Then
                 hFunc = GetProcAddress(hMod, "EnableThemeDialogTexture")
                 If hFunc Then
                    Call Dword hFunc Using EnableDialogTheme(hDlg, dwStyle) To nRet
                    Function = nRet
                 End If
                 FreeLibrary hMod
              End If
          End Function
      #EndIf
      kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

      Comment


      • #4
        Kev,

        I saved the <?xml ... </assembly>
        as wumenuw3.exe.manifest in the folder containing wumenuw3.exe

        next to name i tried name="wumenuw3.exe" and name="oasys.clientwriteup.wumenuw3"

        next to description i have

        <description>Client Writeup for the CPA.</description>

        I get an error when i then try to run wumenuw3.exe
        Something about it failed and reinstalling may correct the problem
        If I rename the file to wumenuw3.xex.manifest the program will run again.
        (renamed so it wont find wumenuw3.exe.manifest)

        any ideas what im doing wrong (it's on win XP )
        Last edited by Fred Buffington; 9 Feb 2008, 09:23 PM.
        Client Writeup for the CPA

        buffs.proboards2.com

        Links Page

        Comment


        • #5
          Fred, use the following and it should fix the problem. The error occurs because the XML tags are case sensitive. It seems that a lot of imported code from the old forum will be broken, since it is all converted to lower case. I can't edit my old posts either

          Code:
          <?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>
          kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

          Comment


          • #6
            Thanks Kev. No error now.
            Client Writeup for the CPA

            buffs.proboards2.com

            Links Page

            Comment

            Working...
            X