How to turn off manifest theming for specific controls

@Wolfgang_Orth had a question in the Clarion Live Chat today about why do column headers keep the background theme colouring even though he was specifically setting PROPLIST:HdrBackColor to COLOR:Blue.

I believe this is how it should be but have found a way to turn off theming for specific controls.

What is needed is a call to the Windows API SetWindowTheme, which belongs in UXTheme.dll in the system32 (for 64 bit os’s) directory.

Another requirement will be a .lib for that call. This can be created using LibMaker, and I have already made one here : Lib for SetWindowTheme. You will need to add this lib to the app project in the solution tree.

Inside of global Map you need to make the following declaration.

MODULE ('uxtheme.dll') 
    SetWindowTheme(unsigned hwnd, *CSTRING pszSubAppName, *CSTRING pszSubIdList),long, PASCAL,RAW,  NAME ('SetWindowTheme'),PROC!,DLL(__SetWindowTheme_)
END

Then inside your procedure where you need to turn theming off for a specific control, declare a local variable like the following:

blankParameter CSTRING(' ')

Then after the window has been opened you can make your call as follows:

SetWindowTheme(?TheControl{PROP:Handle},blankParameter, blankParameter)

This will turn off theming for the specific control that you have chosen.

2 Likes