gzxwh2010 发表于 2010-12-22 22:48:09

网络音乐盒加载皮肤后退出时提示出错

#AutoIt3Wrapper_outfile=网络音乐盒.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=播放网络音乐电台
#AutoIt3Wrapper_Res_Fileversion=2.0.1.0
#AutoIt3Wrapper_Res_LegalCopyright=shengda79.com
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

$hGui=GUICreate ("")
;加载皮肤
Dim $Dll   
FileInstall("SKINCRAFTERDLL.DLL", @TempDir& "\SKINCRAFTERDLL.DLL",1)
FileInstall("VISTA_STYLE.SKF", @TempDir& "\VISTA_STYLE.SKF",1)
$Dll = DllOpen(@TempDir& "\SKINCRAFTERDLL.DLL")
DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", @TempDir& "\VISTA_STYLE.SKF")
DllCall($Dll, "int:cdecl", "DecorateAs", "int", $hGui, "int", 25)
DllCall($Dll, "int:cdecl", "ApplySkin")

Opt("TrayMenuMode",1)
Opt("TrayOnEventMode",1)
Opt("GUIOnEventMode",1)

;加载用标题
Dim $LoadingTitle="正在加载网络播放器,请稍候..."
;频道总数(基于1开始计算),起始频道(基于0开始计算)
Dim $ChannelTotalNo=5,$StartChannelNo=3
;控件,标题,网址,主窗口宽度,主窗口高度,页面控件X坐标,页面控件Y坐标,页面控件宽度,页面控件高度
Dim $song[$ChannelTotalNo]= _
[ _
["","SongTaste 用音乐倾听彼此","http://www.songtaste.com/radio.php",356,544,-7,0,390,560], _
["","新浪音乐盒","http://music.sina.com.cn/iframe/yueku/msnshell/msnshellplayer.shtml",308,405,-2,-27,307,500], _
["","百度音乐盒","http://box.zhangmen.baidu.com",525,610,0,0,859,582], _
["","百度电台","http://fm.mp3.baidu.com/",458,265,-125,-155,720,600], _
["","豆瓣电台","http://douban.fm/radio",428,214,0,0,421,186] _
]

;创建托盘开始
TraySetOnEvent(-13,"_mini")
$settingsitem=TrayCreateMenu("切换频道")
For $i=0 To $ChannelTotalNo-1
      $song[$i]=TrayCreateItem($song[$i],$settingsitem)
      TrayItemSetOnEvent(-1,"maintray")
Next
TrayItemSetState($song[$StartChannelNo-1],1+128)
TrayCreateItem("")
$displayitem=TrayCreateItem("隐藏窗口")
TrayItemSetOnEvent(-1,"maintray")
$aboutitem=TrayCreateItem("关于")
TrayItemSetOnEvent(-1,"maintray")
TrayCreateItem("")
$exititem=TrayCreateItem("退出")
TrayItemSetOnEvent(-1,"maintray")
TraySetClick(16)
;创建托盘结束

;创建GUI开始
$Form = GUICreate("",200,200,-1,-1)
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "_mini")
$oIE = ObjCreate("Shell.Explorer.2")
$GUIActiveX= GUICtrlCreateObj($oIE,-3000,0)
;创建GUI结束

Dim $stat=1
While 1
      If $stat=1 Then
                $stat=0
                changchannel($StartChannelNo)
                ;特殊情况
                If $song[$StartChannelNo]="新浪音乐盒" Then _IEImgClick($oIE, "icon_21.gif","src")
      EndIf
      Sleep(100)
WEnd

Func maintray()
      Switch @TRAY_ID
                Case $displayitem
                        TrayItemSetState($displayitem,4)
                        _mini()
                Case $aboutitem
                        TrayItemSetState($aboutitem,4)
                        Msgbox(0,"关于","网络音乐播放器"&@CRLF&"By:春花秋月")
                Case $exititem
                        Exit
      EndSwitch
      For $i=0 To $ChannelTotalNo-1
                If @TRAY_ID=$song[$i] Then
                        $StartChannelNo=$i
                        $stat=1
                EndIf
      Next
EndFunc

Func changchannel($ChannelNO=0)
      For $i=0 To $ChannelTotalNo-1
                If $i=$ChannelNO Then
                        TrayItemSetState($song[$i],1+128)
                Else
                        TrayItemSetState($song[$i],4+64)
                EndIf
      Next
      TraySetToolTip($song[$ChannelNO])
      WinSetTitle($Form,"",$LoadingTitle)
      GUICtrlSetPos($GUIActiveX,-3000,$song[$ChannelNO],$song[$ChannelNO],$song[$ChannelNO])
      WinMove($Form,"",(@DesktopWidth-$song[$ChannelNO])/2,(@DesktopHeight-$song[$ChannelNO])/2,$song[$ChannelNO],$song[$ChannelNO])
      open_anim()
      WinMove($Form,"",(@DesktopWidth-$song[$ChannelNO])/2,(@DesktopHeight-$song[$ChannelNO])/2,$song[$ChannelNO],$song[$ChannelNO])
      _IENavigate($oIE,$song[$ChannelNO])
      GUICtrlSetPos($GUIActiveX,$song[$ChannelNO],$song[$ChannelNO],$song[$ChannelNO],$song[$ChannelNO])
      WinSetTitle($Form,"",$song[$ChannelNO])
EndFunc

Func _mini()
      If BitAND(WinGetState($Form),2)=2 Then
                TrayItemSetText($displayitem,"显示窗口")
                GUISetState(@SW_HIDE,$Form)
      Else
                TrayItemSetText($displayitem,"隐藏窗口")
                GUISetState(@SW_SHOW,$Form)
                GUISetState(@SW_RESTORE,$Form)
      endif
EndFunc

Func _exit()
      ;关闭窗口时的特效start
      GUICtrlSetPos($GUIActiveX,-3000,0)
      For $i=17 To 1 Step -1
                WinSetTrans ($Form, "", $i*15 )
                $p=WinGetPos($Form)
                WinMove($Form, "", $p-1, $p-1, $p+2, $p+2)
                Sleep(5)
      Next
      ;关闭窗口时的特效end
      Exit
EndFunc

Func open_anim()
;特效start
      WinSetTrans ($Form, "",0 )
      GUISetState()
      $p=WinGetPos($Form)
      For $i=1 To 17
                WinSetTrans ($Form, "", $i*15 )
                If $i<12 Then
                        WinMove($Form, "", $p-$i, $p-$i, $p+$i*2, $p+$i*2)
                        $x=WinGetPos($Form)
                Else
                        $k=$i-12
                        WinMove($Form, "", $x+$k, $x+$k, $x-$k*2, $x-$k*2)
                EndIf
                Sleep($i)
      Next
;特效end
EndFunc

Func Quit()
    GUISetState(@SW_HIDE)
    DllCall($dll, "int", "DeInitDecoration")
    DllCall($dll, "int", "RemoveSkin")
    DllClose($dll)
    FileDelete ( @TempDir&"\SkinCrafterDll.dll" )
    FileDelete ( @TempDir&"\vista_style.skf" )
    Exit
EndFunc

这个是经过了加载皮肤的脚本,在退出后又会弹出,如下图:

zch11230 发表于 2010-12-23 02:51:55

http://www.autoitx.com/thread-20608-1-2.html
皮肤没有释放要exit的地方应该改为 quit()

guland 发表于 2010-12-23 08:30:55

怎么这么低级的问题最近好多人问呢???   是不是只是抄袭别人的部分代码,都不看的Func Quit()
    GUISetState(@SW_HIDE)
    DllCall($dll, "int", "DeInitDecoration")
    DllCall($dll, "int", "RemoveSkin")
    DllClose($dll)
    FileDelete ( @TempDir&"\SkinCrafterDll.dll" )
    FileDelete ( @TempDir&"\vista_style.skf" )
    Exit
EndFunc

上面这段代码你们拿过去怎么都没有用???

gzxwh2010 发表于 2010-12-23 09:51:01

回复 3# guland
还请版主再指点下,要怎样修改?

gzxwh2010 发表于 2010-12-23 09:52:12

回复 2# zch11230
请问你指的是哪个exit啊?

zw196512 发表于 2010-12-23 11:33:18

学习 谢谢!

guland 发表于 2010-12-23 13:25:50

回复 4# gzxwh2010


    我说的这么明白你还看不懂吗??回去再看看教程吧,我表达能力不强,只要你仔细看教程了 你一定明白的

gzxwh2010 发表于 2010-12-23 13:41:07

回复 7# guland
版主,就是看了教程还是不明白才会请教你的,你说没有使用到,是什么意思啊?难道我的这个脚本就是错在这里?不是你的表达能力不强,而是我们的理解能力不行而已!

afan 发表于 2010-12-23 13:46:32

贴代码就要用代码标签【code】,这样别人好测试,更好直接说明第几行的问题

menfan1 发表于 2010-12-23 14:18:18

exit替换成quit()

lxz 发表于 2010-12-23 16:06:12

是退出皮肤问题.....

gzxwh2010 发表于 2010-12-23 16:06:26

回复 10# menfan1 谢谢,问题已解决!

83265358 发表于 2010-12-23 18:21:56

同样的问题问了两次!!!
页: [1]
查看完整版本: 网络音乐盒加载皮肤后退出时提示出错