<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="WindowsShell" processorArchitecture="x86" version="5.1.0.0" type="win32"/>
<description>Windows Shell</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="x86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>=======================
做法,以上代码一点别动,存成exe文件名.exe.manifest 文件,并放在与exe相同的文件夹下.
你的程序就可以实现xp的界面效果了.
简直是太神了.这就是几行文本呀?
为何能有这么大的功力呀?
请大家讨论一下.
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="WindowsShell" processorArchitecture="x86" version="5.1.0.0" type="win32"/>
<description>Windows Shell</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="x86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>=======================
做法,以上代码一点别动,存成exe文件名.exe.manifest 文件,并放在与exe相同的文件夹下.
你的程序就可以实现xp的界面效果了.
简直是太神了.这就是几行文本呀?
为何能有这么大的功力呀?
请大家讨论一下.
#RT_MANIFEST = 24
#LANG_ID = $2052
filename.s="filename.exe"
manifest.s=filename+".manifest"
size.l=FileSize(manifest)
If size>0
mem.l=AllocateMemory(size)
ReadFile(0,manifest)
ReadData(mem,size)
CloseFile(0)
EndIf
hUpdateRes = BeginUpdateResource_(filename, FALSE)
; if hUpdateRes = 0 then error occured
result = UpdateResource_(hUpdateRes,#RT_MANIFEST,1,#LANG_ID,mem,size)
result = EndUpdateResource_(hUpdateRes, #False)
FreeMemory(0)
End
没找到原因.
1.这个文件的内容是否可以不变呀?永远适用任何exe文件.
2.实现的原理是什么?
===================================================
如果只写文件,那么只能够应用到那些引用有comctl6.0控件(如RichTextBox Toolbar ListView TreeView RegBar等控件)的exe之中,并不是说有exe都引用comctl6.0控件的,这个时候,你需要调用一条api,并且在你的程序第一个form的Initalize事件中调用他,写法如下(这个过程必须放在模块中):Public Type tagInitCommonControlsEx
lngSize As Long
lngICC As Long
End Type
Private Declare Function InitCommonControlsEx Lib "comctl32.dll" _
(iccex As tagInitCommonControlsEx) As Boolean
Private Const ICC_USEREX_CLASSES = &H200
Public Function InitCommonControlsVB() As Boolean
On Error Resume Next
Dim iccex As tagInitCommonControlsEx
' Ensure CC available:
With iccex
.lngSize = LenB(iccex)
.lngICC = ICC_USEREX_CLASSES
End With
InitCommonControlsEx iccex
InitCommonControlsVB = (err.Number = 0)
On Error GoTo 0
End Function接着你只要在你的启动窗体的form_Initalize事件里面调用
InitCommonControlsVB
即可
另外,这并不是ms提倡的标准做法,标准的做法应该是把那个xml文件放在资源里面,资源id为24
至于原理,这是winxp及以后操作系统规定的一种识别应用界面主题的规则,没什么好说的,ms规定了就是这样
最后,我希望lz能结贴