我开发环境是VC.net或VC6,用里面的controls,我发现一个比较怪的现象,如果用vb等工具,按钮会根据操作系统的不同自动适应,例如在winxp下,会变化成xp的按钮式样.
同样也有treeview/listview等,
但我用vc编的程序却无法获得这些效果??我看了flashget,它的也有这些效果,请问到底是怎么回事?

解决方案 »

  1.   

    The following steps introduces XP Theme Style to your project:
    Insert Resource, choose "Custom", input "24" (without quotes) as resource type 
    Copy and paste the following XML sheets into the editor. <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
    <assembly 
       xmlns="urn:schemas-microsoft-com:asm.v1" 
       manifestVersion="1.0">
     <assemblyIdentity 
        processorArchitecture="x86" 
        version="5.1.0.0"
        type="win32"
        name="test.exe"/>
     <description>Test Application</description>
     <dependency>
      <dependentAssembly>
        <assemblyIdentity
             type="win32"
             name="Microsoft.Windows.Common-Controls"
             version="6.0.0.0"
             publicKeyToken="6595b64144ccf1df"
             language="*"
             processorArchitecture="x86"/>
      </dependentAssembly>
     </dependency>
    </assembly>You can replace test.exe and Test Application with any string you like. This will not affect the behaviour of the application.Change resource ID to 1. 
    Add calls to InitCommonControls() in your WinMain(). Don't forget to include commctrl.h and link comctl32.lib. Rebuild your project, all done :-) 
    This special resource type is only recognized by Windows XP. In any other version of Windows (Windows 9x/NT/2000), the program simply runs as before.You can also create a manifest file with the same name of the EXE file, plus an extension .manifest, which contains the same lines as the ones above. For our test.exe, the manifest file is test.exe.manifest.
      

  2.   

    to 土星:
    出了一个asert错误,不过确实效果出来了,请问可以使它不报错吗?一会就给分
      

  3.   

    http://www.codeproject.com/w2k/xptheme.asp
    原来转自这个,给分咯 :)