Announcement

Collapse
No announcement yet.

turn them off for one control?

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

  • turn them off for one control?

    I was searching for why PBS_SMOOTH did not work and found that the sp thems does that. I want to use themes in the program, but the search showed that you can turn off themes for a control but did not show code.

    How would I turn off themes for one control only?
    Barry

  • #2
    "just by calling SetWindowTheme with an empty string your control (button/checkbox/combo etc) will not be painted with the XP Theme. That is easy enough! You will find the SetWindowTheme function in UxTheme.dll which ships starting with Windows XP."
    ...Source: http://raz-soft.com/cc/disable-xp-theme/
    Best regards
    Jules
    www.rpmarchildon.com

    Comment


    • #3
      Code:
      DECLARE FUNCTION SetWindowTheme(BYVAL hWnd AS DWORD, pszSubAppName AS ASCIIZ, pszSubIdList AS ASCIIZ) AS LONG   
       
      '------------------------------------------------------------------------------
      'Purpose: by calling SetWindowTheme with an empty string your control
      '         (button/checkbox/combo etc) will not be painted with the XP Theme.
      '
      'Example: LOCAL hButton AS DWORD
      '         hButton = GetDlgItem( CBHNDL, %IDOK )
      '         lRes = DisableXPThemeControl ( hbutton )
      '         InvalidateRect hButton,BYVAL %NULL,%TRUE
      '------------------------------------------------------------------------------
      FUNCTION DisableXPThemeControl(BYVAL hControl AS DWORD) AS LONG
        LOCAL hLib AS DWORD, pProc AS DWORD, lRes AS LONG
        hLib = LoadLibrary("UxTheme.dll")
        IF hLib THEN
           pProc = GetProcAddress(hLib, "SetWindowTheme")
           IF pProc THEN
              CALL DWORD pProc USING SetWindowTheme(hControl, " ", " ")  TO lRes
              FUNCTION = lRes
           END IF
           FreeLibrary hLib
        END IF
      END FUNCTION
      Last edited by Jules Marchildon; 2 Feb 2009, 07:15 PM. Reason: added
      Best regards
      Jules
      www.rpmarchildon.com

      Comment

      Working...
      X