Results 1 to 5 of 5

Thread: [RESOLVED] [2005] Applying Themes

  1. #1

    Thread Starter
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Resolved [RESOLVED] [2005] Applying Themes

    Hello guys!

    I have an application that must be able to list & change the windows themes, basically similar to what Desktop properties does. What function in uxtheme.dll must I use to achieve this ¿

    Thanx for any help.
    VB.NET MVP 2008 - Present

  2. #2

    Thread Starter
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: [2005] Applying Themes

    An update.
    It seems as if I can either use the ApplyTheme or SetWindowTheme ( not 100 % sure about that one ).

    The problem is that if I were to use them, I'll need some sort of handle to a theme file. Here is the ApplyTheme API declaration :
    Code:
        <DllImport("uxtheme")> _
        Protected Shared Function SetWindowTheme(ByVal hWnd As IntPtr, ByVal pszSubAppName As String, ByVal pszSubIdList As String) As Integer
        End Function
    
        <DllImportAttribute("uxtheme")> _
        Protected Shared Function ApplyTheme(ByVal hThemeFile As IntPtr, ByVal something As String, ByVal hWnd As IntPtr) As Integer
        End Function
    I think.
    What is hThemeFile here, and how can I use this function to apply a theme through the use of my code ¿
    VB.NET MVP 2008 - Present

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] Applying Themes

    I have some threads on visual styles. They are not fun but not impossible either. Its been a while but I it was something to do with theme parts which get applied to your controls parts. Sorry cant be of more help. Going to bed. Its 4:30 am
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: [2005] Applying Themes

    Hey Rob!
    Thanx, I'll have a look, and see what goes for what.

    I just want to kick myself for always trying to do "the impossible"!
    Sleep well!
    VB.NET MVP 2008 - Present

  5. #5

    Thread Starter
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: [2005] Applying Themes

    I did manage to find a way to apply the Luna visual Style :
    Declarations :
    Code:
        <DllImport("UxTheme.DLL", BestFitMapping:=False, CallingConvention:=CallingConvention.Winapi, CharSet:=CharSet.Unicode, EntryPoint:="#65")> _
        Shared Function SetSystemVisualStyle(ByVal pszFilename As String, ByVal pszColor As String, ByVal pszSize As String, ByVal dwReserved As Integer) As Integer
        End Function
    Useage :
    Code:
        Private Sub btnSetTheme_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSetTheme.Click
            SetSystemVisualStyle("C:\WINDOWS\resources\Themes\Luna\Luna.msstyles", "Metallic", "NormalSize", 0)
        End Sub
    VB.NET MVP 2008 - Present

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width