#Include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$From1 = GUICreate("test1", 200,390)
$Button1 = GUICtrlCreateButton("only work",5,5, 190,50)
$Button2 = GUICtrlCreateButton("B2",5,60, 190,50)
$Button3 = GUICtrlCreateButton("B3",5,115, 190,50)
$Button4 = GUICtrlCreateButton("B4",5,170, 190,50)
$Button5 = GUICtrlCreateButton("B5",5,225, 190,50)
$Button6 = GUICtrlCreateButton("B6",5,280, 190,50)
$Button7 = GUICtrlCreateButton("B7",5,335, 190,50)
z_SkinSharp_SkinChange("中國紅china.she")
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Button1
$From2 = GUICreate("test2", 250,170)
$Button21 = GUICtrlCreateButton("Unload $From2",5,5, 240,50)
$Button22 = GUICtrlCreateButton("Unload all From",5,60, 240,50)
$Button23 = GUICtrlCreateButton("Change Skin",5,115, 240,50)
z_SkinSharp_SkinChange2("insomnia.she", $From2)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Button21
z_SkinSharp_Delete($From2)
Case $Button22
z_SkinSharp_DeleteAll()
Case $Button23
z_SkinSharp_SkinChange2("itunes.she", $From2)
EndSwitch
WEnd
GUIDelete($From2)
EndSwitch
WEnd
GUIDelete($From1)
Exit
;=======================================
Func z_SkinSharp_SkinChange($Filename_She)
$Dll = DllOpen('Skin.dll')
DllCall($Dll, "int", "SkinH_AttachEx", "str", $Filename_She, "str", "mhgd")
;int SkinH_AttachEx(LPCTSTR strSkin, LPCTSTR strPwd) 加载指定路径的皮肤进行换肤
;Public Declare Function SkinH_AttachEx Lib "SkinH_VB6.dll" (ByVal strSkin As String, ByVal strPwd As String) As Long
; strSkin 皮肤文件路径
; strPwd 皮肤密钥
;成功返回0,失败返回非0
DllCall($Dll, "int", "SkinH_SetAero", "int", 1)
;int SkinH_SetAero(HWND hWnd) 设置Vista特效
;Public Declare Function SkinH_SetAero Lib "SkinH_VB6.dll" (ByVal hWnd As Long) As Long
;成功返回0,失败返回非0
EndFunc
Func z_SkinSharp_SkinChange2($Filename_She, $hWnd) ;test
$Dll = DllOpen('Skin.dll')
;DllCall($Dll, "int", "SkinH_LockUpdate", "int", $hWnd, "int", 1) ;unwork
;DllCall($Dll, "int", "SkinH_LockUpdate", "int", _WinAPI_GetCurrentProcessID(), "int", 0) ;unwork
;int SkinH_LockUpdate(HWND hWnd,int nLocked) 用于填充表格或者列表控件数据时,重复绘制滚动条影响执行效率问题
;Public Declare Function SkinH_LockUpdate Lib "SkinH_VB6.dll" (ByVal hWnd As Long, ByVal nLocked As Integer) As Long
;hWnd 指定窗体或控件的句柄
;nLocked 是否锁定。1为锁定,0为解锁
;成功返回0,失败返回非0
DllCall($Dll, "int", "SkinH_SetAero", "int", 1)
;DllCall($Dll, "int", "SkinH_SetAero", "int", 0) ;unwork
;DllCall($Dll, "int", "SkinH_SetAero", "hwnd", $hWnd) ;unwork
;DllCall($Dll, "int", "SkinH_SetAero", "int", $hWnd) ;unwork
;DllCall($Dll, "int", "SkinH_SetAero", "int", ControlGetHandle("[ACTIVE]", "", "")) ;unwork
;DllCall($Dll, "int", "SkinH_SetAero", "int", _WinAPI_GetCurrentProcessID()) ;unwork
MsgBox(0,"", "$hWnd="&$hWnd &@CRLF& _
"Control_GetNowHandle="&ControlGetHandle("[ACTIVE]", "", "") &@CRLF& _
"_WinAPI_GetCurrentProcessID="&_WinAPI_GetCurrentProcessID())
;DllCall($Dll, "int", "SkinH_AttachEx", "str", $Filename_She, "str", "mhgd")
;DllCall($Dll, "int", "SkinH_AttachEx", "str", $Filename_She) ;wrong
DllCall($Dll, "int", "SkinH_AttachEx", "str", $Filename_She, "str", "")
EndFunc
Func z_SkinSharp_Delete($hWnd) ;release $hWnd
$Dll = DllOpen('Skin.dll')
DllCall($Dll, "int", "SkinH_DetachEx", "int", $hWnd) ;release not very clear
;DllCall($Dll, "int", "SkinH_DetachEx", "int", ControlGetHandle("[ACTIVE]", "", "")) ;release current button
;DllCall($Dll, "int", "SkinH_DetachEx", "int", _WinAPI_GetCurrentProcessID()) ;unwork
EndFunc
Func z_SkinSharp_DeleteAll() ;all release
$Dll = DllOpen('Skin.dll')
DllCall($Dll, "int", "SkinH_Detach") ;OK
EndFunc