Open the program's visual Styles

Source: Internet
Author: User

First look at Ms's interpretation of visual styles:

Windows XP and later operating systems support a feature called visual styles that enables the appearance of common contro LS to change based on the theme chosen by the user. Prior to Windows 8, your must specifically configure your application to use visual styles; Otherwise, the application ' s common controls is always rendered in the style associated with the Windows Classic theme, R Egardless of the currently selected theme. In Windows 8, visual styles can ' t is turned off, Windows Classic mode no longer exists, and high Contrast mode have been mo Dified to work with visual styles.

After XP, the system supports an interface called visual style that can change as the theme of the system changes. The program must explicitly enable this style, otherwise the program is a classic style interface, the program interface does not change with the system theme. Win8 also added a high-contrast mode interface, which is not discussed at this stage.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb773187 (v=vs.85). aspx

You can obviously feel that visual styles are a lot more rounded and beautiful.

Ways to open Visual styles

To use Visual Styles, you need a sixth version or an updated ComCtl32.dll, ComCtl32.dll not be re-released, just preset in the system. The XP series is available in both the fifth and Sixth editions.

ComCtl32.dll, version sixth of ComCtl32.dll contains the user controls and the common controls. By default, the program uses the user controls defined in User32.dll and the common controls defined in version fifth ComCtl32.dll

ComCtl32.dll Version Introduction

ComCtl32.dll
Version Distribution Platform
4.0 Windows and Microsoft Windows NT 4.0
4.70 Internet Explorer 3.0
4.71 Microsoft Internet Explorer 4.0
4.72 Microsoft Internet Explorer 4.01 and Windows 98
5.80 Windows 98 Second Edition and Microsoft Internet Explorer 5
5.81 Windows Millennium Edition (Windows Me), Windows $, Microsoft Internet Explorer 5.01, Microsoft Internet Explorer 5.5, and Microsoft Internet Explorer 6
5.82 Windows XP, Windows Server 2003, Windows Vista, Windows Server, and Windows 7
6.0 Windows XP, Windows Server 2003
6.10 Windows Vista, Windows Server, and Windows 7

http://msdn.microsoft.com/en-us/library/windows/desktop/hh298349 (v=vs.85). aspx

@: Add a program listing Method 1 Create a new text XML-formatted manifest file "program name. Exe.manifest" in the project directory and add it to the resource with the file content [HTML]View PlainCopy 
  1. <? XML version= "1.0" encoding="UTF-8" standalone="yes"?>
  2. <Assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0">
  3. <assemblyidentity
  4. version="1.0.0.0"
  5. processorarchitecture="*"
  6. name="CompanyName.ProductName.YourApplication"
  7. type="Win32"
  8. />
  9. <description>your application description here. </Description>
  10. <dependency>
  11. <dependentassembly>
  12. <assemblyidentity
  13. type="Win32"
  14. name="Microsoft.windows.common-controls"
  15. version="6.0.0.0"
  16. processorarchitecture="*"
  17. publickeytoken="6595B64144CCF1DF"
  18. language="*"
  19. />
  20. </dependentassembly>
  21. </Dependency>
  22. </Assembly>


Mainfest: Description section assemblyidentity element's attribute set
Attribute Description
Version Version of the manifest. The version must be in the form major.minor.revision.build (which is, N.N.N.N, where n <=65535).
ProcessorArchitecture Processor for which your application is developed.
Name Includes company name, product name and application name.
Type Type of your application, such as Win32.

Dependency segment assemblyidentity Element property set

Attribute Description
Type Type of the dependency component, such as Win32.
Name Name of the component.
Version Version of the component.
ProcessorArchitecture Processor that the component was designed for. Specifies the processor. Valid values are MSIL, x86, IA64, and AMD64.
PublicKeyToken Key token used with this component.
Language Language of the component.

@: Method 2 for adding a program manifest

After vs2005, setting up visual styles does not require a program deployment manifest file, but simply sends a compilation instruction. Just add a few lines to the "stdafx.h".

[CPP]View PlainCopy 
    1. #pragma COMMENT (linker, "\"/manifestdependency:type= ' Win32 ' \
    2. Name= 'microsoft.windows.common-controls ' version=' 6.0.0.0 ' \
    3. Processorarchitecture= '* ' publickeytoken=' 6595b64144ccf1df ' language=' * '"")

The MSND said it needed

[CPP]View PlainCopy 
  1. <span style="White-space:pre" > </span>//If an application manifest running on Windows XP specifies that you want to
  2. //using ComCtl32.dll version 6 or later to enable visualization,
  3. //You need Initcommoncontrolsex ().  Otherwise, the window cannot be created.
  4. Initcommoncontrolsex Initctrls;
  5. Initctrls.dwsize = sizeof (initctrls);
  6. //Set it to include all the applications that you want to use in the
  7. //Public control class.
  8. INITCTRLS.DWICC = icc_win95_classes;
  9. Initcommoncontrolsex (&initctrls);

But found not added also nothing, XP can be normal implementation, know how to say

@: Turn off visual Styles

1: You can call the Setwindowtheme function to close the visual styles of one or more controls [CPP]View PlainCopy 
    1. #include "Uxtheme.h"
    2. #pragma comment (lib, "UxTheme.lib")
[CPP]View PlainCopy  
    1. Setwindowtheme (hwnd, L "", L"");
2: You can also call InitInstance before calling void Setthemeappproperties (DWORD dwFlags), do not set the STAP_ALLOW_NONCLIENT flag to close the entire program for all windows of the visual Styles [CPP]View PlainCopy  
    1. #include "Uxtheme.h"
    2. #pragma comment (lib, "UxTheme.lib")

[CPP]View PlainCopy 
    1. DWORD dwFlags = (Stap_allow_controls | Stap_allow_webcontent);
    2. Setthemeappproperties (DwFlags);

http://blog.csdn.net/x356982611/article/details/18403869

Open the program's visual Styles

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.