Board index » cppbuilder » How to turn off theming to a component

How to turn off theming to a component


2006-01-28 09:42:19 AM
cppbuilder46
What is the correct way to turn off theming on a particular control. from
Microsoft help I got:
SetWindowTheme (hwndButton, TEXT (" "), TEXT (" "));
I converted to, compiler was OK with it:
SetWindowTheme (ProgressBar->Handle, (wchar_t*)(L""), (wchar_t*)(L""));
but I then got:
[Linker Error] Unresolved external 'SetWindowTheme' referenced from
D:\BORLAND\BUILDER_6\TESTING\SB_TEST\UNIT1.OBJ
What am I doing wrong?
thanks
daryl
 
 

Re:How to turn off theming to a component

You will need to dynamically load the UxTheme.dll and useGetProcAddress to
access SetWindowTheme().
typedef HRESULT STDAPICALLTYPE (*TSetWindowTheme)(
HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList);
HINSTANCE dll = ::LoadLibrary("UxTheme.dll");
if (dll)
{
TSetWindowTheme setWindowTheme =
(TSetWindowTheme) ::GetProcAddress(dll, "SetWindowTheme");
if (setWindowTheme)
setWindowTheme(ProgressBar->Handle, L"", L"");
::FreeLibrary(dll);
}
HTH,
- Clayton