Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to detect the style of user window?

How to detect the style of user window?

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cylix2000
    wrote on last edited by
    #1

    Some XP user use the XP form style, some of them disable the style to use the classic one. However, this style really affect the look of my form. How can I know what is this setting in user computer?

    K 1 Reply Last reply
    0
    • C cylix2000

      Some XP user use the XP form style, some of them disable the style to use the classic one. However, this style really affect the look of my form. How can I know what is this setting in user computer?

      K Offline
      K Offline
      kasik
      wrote on last edited by
      #2

      You can P/Invoke UxTheme.dll which controls the window styles in XP like this...

      <DllImport("UxTheme.dll", _
      CallingConvention:=CallingConvention.Winapi, _
      CharSet:=CharSet.Auto)> _
      Private Shared Function IsThemeActive() As Boolean
      End Function

      If this function returns true, the user is running a theme, if it returns false then the user is running 'Windows Classic Style' - no themes. Hope this helps :) Cheers, Will H

      C 1 Reply Last reply
      0
      • K kasik

        You can P/Invoke UxTheme.dll which controls the window styles in XP like this...

        <DllImport("UxTheme.dll", _
        CallingConvention:=CallingConvention.Winapi, _
        CharSet:=CharSet.Auto)> _
        Private Shared Function IsThemeActive() As Boolean
        End Function

        If this function returns true, the user is running a theme, if it returns false then the user is running 'Windows Classic Style' - no themes. Hope this helps :) Cheers, Will H

        C Offline
        C Offline
        cylix2000
        wrote on last edited by
        #3

        Thank you so much and It is really a great hint for me, but it does not work by copy and paste. Where should I place it in my module ? Thank you~

        K 1 Reply Last reply
        0
        • C cylix2000

          Thank you so much and It is really a great hint for me, but it does not work by copy and paste. Where should I place it in my module ? Thank you~

          K Offline
          K Offline
          kasik
          wrote on last edited by
          #4

          To add it to a module you'll have to do two things... 1) Change the line

          Private Shared Function IsThemeActive() As Boolean

          to

          Public Function IsThemeActive() As Boolean

          (i.e. remove the word Shared and change the functions visibility to Public) 2) Add

          Imports System.Runtime.InteropServices

          to the top of your file. I havent done any VB.Net in a while so I hope that works :) Cheers, Will H

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups