Pergunta

I'm using pure WINAPI, and need to send the TB_GETMETRICS message. However, that message only works if you add a manifest file to your application with a reference to Common Controls version 6.0. I added it, the message is working, but now my application is using Vista/Windows 7 visual styles, which I do not want.

Is there any way to keep the Common Controls 6.0 reference while using Classic theme, either by modifying the manifest file or by calling some API function?

Note: I tried SetWindowTheme but the result was a mix of Classic and Aero.

EDIT: I hadn't read the SetWindowTheme function correctly, so I was thinking calling it for the parent hWnd would automatically call it for all its child. It turns out I need to call it for each control I want to use Windows Classic. It's working as it should now.

Foi útil?

Solução

To disable visual styles for all controls, call SetThemeAppProperties(STAP_ALLOW_NONCLIENT) or SetThemeAppProperties(0) before you create your main window.

To disable visual styles per HWND you can call SetWindowTheme(hwndControl,L"",L"")

If you need to support systems without v6 common controls you can probably figure out which system metrics (or hardcoded values) are used in the toolbar control by playing with the system metric values and system DPI.

Outras dicas

Solved by using SetWindowTheme (with L"" as parameters) properly: all I had to do was call it for each and every control my application creates. It feels hackish but gets the job done.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top