不知道这样合不合要求。#include-once
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\..\ico\ico\Chat.ico
#AutoIt3Wrapper_UseUPX=n
#AutoIt3Wrapper_Au3Check_Stop_OnWarning=y
#AutoIt3Wrapper_Run_Tidy=y
#Tidy_Parameters=/sfc
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
Opt("TrayIconHide", 1)
If _Singleton(@ScriptName, 1) = 0 Then
MsgBox(64, "警告!", "您只能运行一个此应用程序!")
Exit (1)
EndIf
If Not FileExists(@TempDir & "\") Then DirCreate(@TempDir & "\")
;FileInstall("IE1.png", @TempDir & "\normal.png", 1)
FileInstall("diannao1.png", @TempDir & "\diannao1.png", 1)
FileInstall("diannao2.png", @TempDir & "\diannao2.png", 1)
FileInstall("diannao3.png", @TempDir & "\diannao3.png", 1)
FileInstall("IE1.png", @TempDir & "\IE1.png", 1)
FileInstall("IE2.png", @TempDir & "\IE2.png", 1)
FileInstall("IE3.png", @TempDir & "\IE3.png", 1)
FileInstall("QQ1.png", @TempDir & "\QQ1.png", 1)
FileInstall("QQ2.png", @TempDir & "\QQ2.png", 1)
FileInstall("QQ3.png", @TempDir & "\QQ3.png", 1)
FileInstall("WD1.png", @TempDir & "\WD1.png", 1)
FileInstall("WD2.png", @TempDir & "\WD2.png", 1)
FileInstall("WD3.png", @TempDir & "\WD3.png", 1)
FileInstall("gj1.png", @TempDir & "\gj1.png", 1)
FileInstall("gj2.png", @TempDir & "\gj2.png", 1)
FileInstall("gj3.png", @TempDir & "\gj3.png", 1)
FileInstall("leave1.png", @TempDir & "\leave1.png", 1)
FileInstall("leave2.png", @TempDir & "\leave2.png", 1)
FileInstall("leave3.png", @TempDir & "\leave3.png", 1)
FileInstall("zh1.png", @TempDir & "\normal-xoyo.png", 1)
FileInstall("zh2.png", @TempDir & "\over-xoyo.png", 1)
FileInstall("zh3.png", @TempDir & "\pressed-xoyo.png", 1)
FileInstall("Playlet's Launcher.exe", @TempDir & "\Playlet's Launcher.exe", 1)
_GDIPlus_Startup()
;Opt("TrayAutoPause", 0)
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
$backpng = @ScriptDir & "\GUIBK.png"
Global Const $diannao1 = _GDIPlus_ImageLoadFromFile(@TempDir & "\diannao1.png")
Global Const $diannao2 = _GDIPlus_ImageLoadFromFile(@TempDir & "\diannao2.png")
Global Const $diannao3 = _GDIPlus_ImageLoadFromFile(@TempDir & "\diannao3.png")
Global Const $IE1 = _GDIPlus_ImageLoadFromFile(@TempDir & "\IE1.png")
Global Const $IE2 = _GDIPlus_ImageLoadFromFile(@TempDir & "\IE2.png")
Global Const $IE3 = _GDIPlus_ImageLoadFromFile(@TempDir & "\IE3.png")
Global Const $QQ1 = _GDIPlus_ImageLoadFromFile(@TempDir & "\QQ1.png")
Global Const $QQ2 = _GDIPlus_ImageLoadFromFile(@TempDir & "\QQ2.png")
Global Const $QQ3 = _GDIPlus_ImageLoadFromFile(@TempDir & "\QQ3.png")
Global Const $WD1 = _GDIPlus_ImageLoadFromFile(@TempDir & "\WD1.png")
Global Const $WD2 = _GDIPlus_ImageLoadFromFile(@TempDir & "\WD2.png")
Global Const $WD3 = _GDIPlus_ImageLoadFromFile(@TempDir & "\WD3.png")
Global Const $gj1 = _GDIPlus_ImageLoadFromFile(@TempDir & "\gj1.png")
Global Const $gj2 = _GDIPlus_ImageLoadFromFile(@TempDir & "\gj2.png")
Global Const $gj3 = _GDIPlus_ImageLoadFromFile(@TempDir & "\gj3.png")
Global Const $NormalImage_Small = _ResizeBitmap(@TempDir & "\normal.png", 118, 53)
Global Const $OverImage_Small = _ResizeBitmap(@TempDir & "\over.png", 118, 53)
Global Const $PressedImage_Small = _ResizeBitmap(@TempDir & "\pressed.png", 118, 53)
Global Const $NormalImage_Exit = _GDIPlus_ImageLoadFromFile(@TempDir & "\leave1.png")
Global Const $OverImage_Exit = _GDIPlus_ImageLoadFromFile(@TempDir & "\leave2.png")
Global Const $PressedImage_Exit = _GDIPlus_ImageLoadFromFile(@TempDir & "\leave3.png")
Global Const $NormalImage_xoyo = _GDIPlus_ImageLoadFromFile(@TempDir & "\normal-xoyo.png")
Global Const $OverImage_xoyo = _GDIPlus_ImageLoadFromFile(@TempDir & "\over-xoyo.png")
Global Const $PressedImage_xoyo = _GDIPlus_ImageLoadFromFile(@TempDir & "\pressed-xoyo.png")
;~Global Const $WS_EX_COMPOSITED = 0x2000000
Global Const $AC_SRC_ALPHA = 1
Global Const $Sensitivity = 200
Global Const $Width = 565
Global Const $Height = 113
;Global $PosX = @DesktopWidth - 868
Global $PosX = @DesktopWidth - 565
;Global $PosY = @DesktopHeight - 768
Global $PosY = 0
Global $Pause = 0
Global $LastActiveWindow = ""
Global $Offline = 1
Dim $LabelArray[12][2]
Dim $Over[12]
Dim $Pressed[12]
fix()
#Region Setup
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
If @error Then
Return SetError(@error, 0, 0)
ElseIf $Ret[0] = 0 Then
Return SetError(4, 0, 0)
Else
Return 1
EndIf
EndFunc ;==>_API_SetLayeredWindowAttributes
Func _ResizeBitmap($sFile, $newW, $newH)
Local $oldImage, $GC, $newBmp, $newGC
;加载图像
$oldImage = _GDIPlus_ImageLoadFromFile($sFile)
;创建新形象
$GC = _GDIPlus_ImageGetGraphicsContext($oldImage)
$newBmp = _GDIPlus_BitmapCreateFromGraphics($newW, $newH, $GC)
$newGC = _GDIPlus_ImageGetGraphicsContext($newBmp)
;绘制
_GDIPlus_GraphicsDrawImageRect($newGC, $oldImage, 0, 0, $newW, $newH)
;Clenaup
_GDIPlus_GraphicsDispose($GC)
_GDIPlus_GraphicsDispose($newGC)
_GDIPlus_ImageDispose($oldImage)
Return $newBmp
EndFunc ;==>_ResizeBitmap
Func fix()
#Region Image GUI
$GUI = GUICreate("Launcher-Playlet", $Width, $Height, $PosX, $PosY, $WS_POPUP, $WS_EX_LAYERED, WinGetHandle("[CLASS:Progman]"))
WinSetOnTop("Launcher-Playlet", "", 1)
GUISetIcon(@TempDir & "\devilish.ico")
GUISetState(@SW_SHOW, $GUI)
;皮肤创作区
$Skin = _ImageDraw()
For $i = 1 To 11
$Over[$i] = _ImageDraw("over", $i)
$Pressed[$i] = _ImageDraw("pressed", $i)
Next
#EndRegion Image GUI
#Region GUI for holding button text, also for getting hover position
$ControlGUI = GUICreate("ControlGUI", $Width, $Height, $PosX, $PosY, $WS_POPUP, BitOR($WS_EX_LAYERED, 0x2000000), $GUI)
GUISetFont(14, 400, -1, "IMPACT") ;字体
GUISetBkColor(0x123456, $ControlGUI)
Global $Name1 = "IE修复"
$LabelArray[1][0] = GUICtrlCreateLabel($Name1, (1 - 1) * 101, 48, 100, 100, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor($LabelArray[1][0], $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($LabelArray[1][0], 0xFFFFFF) ;字体颜色
Global $Name2 = "我的电脑"
$LabelArray[2][0] = GUICtrlCreateLabel($Name2, (2 - 1) * 101, 48, 100, 100, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor($LabelArray[2][0], $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($LabelArray[2][0], 0xFFFFFF) ;字体颜色
Global $Name3 = "QQ"
$LabelArray[3][0] = GUICtrlCreateLabel($Name3, (3 - 1) * 101, 48, 100, 100, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor($LabelArray[3][0], $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($LabelArray[3][0], 0xFFFFFF) ;字体颜色
Global $Name4 = "我的文档"
$LabelArray[4][0] = GUICtrlCreateLabel($Name4, (4 - 1) * 101, 48, 100, 100, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor($LabelArray[4][0], $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($LabelArray[4][0], 0xFFFFFF) ;字体颜色
Global $Name5 = "关机"
$LabelArray[5][0] = GUICtrlCreateLabel($Name5, (5 - 1) * 101, 48, 100, 100, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor($LabelArray[5][0], $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($LabelArray[5][0], 0xFFFFFF) ;字体颜色
$LabelArray[11][0] = GUICtrlCreateLabel("退出", 515, 15, 40, 40);退出标签
GUICtrlSetBkColor($LabelArray[11][0], $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($LabelArray[11][0], 0xFFFFFF)
$LabelArray[10][0] = GUICtrlCreateLabel("转换", 515, 65, 40, 40);转换标签
GUICtrlSetBkColor($LabelArray[10][0], $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($LabelArray[10][0], 0xFFFFFF)
_API_SetLayeredWindowAttributes($ControlGUI, 0x123456, 230)
GUISetState(@SW_SHOW, $ControlGUI)
#EndRegion GUI for holding button text, also for getting hover position
;设置状态变量
For $i = 1 To 11
$LabelArray[$i][1] = 0 ;normal = 0; over = 1; pressed = 2; pressed, but not over on mouseup = 3
Next
;安装主皮肤
SetBitmap($GUI, $Skin, 255)
Global $CursorInfo = GUIGetCursorInfo($ControlGUI)
While 1
#Region Button Checking Part
For $i = 1 To 11
If $CursorInfo[4] = $LabelArray[$i][0] Then ;光标在按钮
While $CursorInfo[4] = $LabelArray[$i][0] ;而在光标按钮
$CursorInfo = GUIGetCursorInfo($ControlGUI)
Switch $CursorInfo[2]
Case 0 ;如果没有按下按钮
If $LabelArray[$i][1] <> 1 Then
$LabelArray[$i][1] = 1 ;状态 = over
SetBitmap($GUI, $Over[$i], 255)
EndIf
Case 1 ;若按下按钮
If $LabelArray[$i][1] <> 2 Then
$LabelArray[$i][1] = 2 ;状态 = pressed
SetBitmap($GUI, $Pressed[$i], 255)
EndIf
While $CursorInfo[2] = 1
$CursorInfo = GUIGetCursorInfo($ControlGUI)
If $CursorInfo[4] = $LabelArray[$i][0] Then ;若按下按钮,并在控制
If $LabelArray[$i][1] <> 2 Then
$LabelArray[$i][1] = 2 ;状态 = pressed
SetBitmap($GUI, $Pressed[$i], 255)
EndIf
Else ;若按下按钮,是在无法控制
If $LabelArray[$i][1] <> 3 Then
$LabelArray[$i][1] = 3 ;状态 = pressed and over
SetBitmap($GUI, $Over[$i], 255)
EndIf
EndIf
Sleep(10)
WEnd
If $CursorInfo[4] = $LabelArray[$i][0] Then RunButton($i)
EndSwitch
Sleep(10)
WEnd
$LabelArray[$i][1] = 0 ;设置的状态正常
SetBitmap($GUI, $Skin, 255) ;重置所有按钮
;更新状态字段时,不通过控制 - 减少使用
EndIf
Next
#EndRegion Button Checking Part
Sleep(10) ;可以改变取决于CPU的速度
WEnd
EndFunc ;==>fix
Func OnAutoItExit()
If IsDeclared("WS_EX_COMPOSITED") Then ;如果脚本没有关闭_Singleton
;_GDIPlus_ImageDispose($NormalImage)
_GDIPlus_ImageDispose($NormalImage_Small)
_GDIPlus_ImageDispose($NormalImage_Exit)
_GDIPlus_ImageDispose($NormalImage_xoyo)
; _GDIPlus_ImageDispose($OverImage)
_GDIPlus_ImageDispose($OverImage_Small)
_GDIPlus_ImageDispose($OverImage_Exit)
_GDIPlus_ImageDispose($OverImage_xoyo)
; _GDIPlus_ImageDispose($PressedImage)
_GDIPlus_ImageDispose($PressedImage_Small)
_GDIPlus_ImageDispose($PressedImage_Exit)
_GDIPlus_ImageDispose($PressedImage_xoyo)
_GDIPlus_Shutdown()
WinActivate($LastActiveWindow)
DirRemove(@TempDir & "\essential2", 1)
Beep(1000, 50)
Beep(2000, 50)
Beep(500, 50)
EndIf
EndFunc ;==>OnAutoItExit
Func RunButton($ButtonNumber)
Switch $ButtonNumber
Case 1
Run(@TempDir & "\IE修复工具.exe")
Case 2
Run("explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
Case 3
$var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TENCENT\QQ", "Install")
If $var == "" Then
MsgBox(0, "提醒", "您电脑没装QQ!")
ElseIf $var <> "" Then
Run($var & "\bin\qq.exe")
EndIf
Case 4
ShellExecute("::{450D8FBA-AD25-11D0-98A8-0800361B1103}")
Case 5
Shutdown(1)
Case 10
Run(@TempDir & "\Playlet's Launcher.exe")
Exit
Case 11
Exit
EndSwitch
EndFunc ;==>RunButton
Func SetBitmap($hGUI, $hImage, $iOpacity)
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
$hScrDC = _WinAPI_GetDC(0)
$hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", $iOpacity)
DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
_WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hMemDC)
EndFunc ;==>SetBitmap
Func _ImageDraw($State = "normal", $Case = "");利用为PNG图片
Local $hGraphic1, $hBitmap, $hGraphic2
Local $Image[13]
;设置默认
$Image[1] = $IE1
$Image[2] = $diannao1
$Image[3] = $QQ1
$Image[4] = $WD1
$Image[5] = $gj1
$Image[10] = $NormalImage_xoyo
$Image[11] = $NormalImage_Small
$Image[12] = $NormalImage_Exit
;创建一个新的位图,这样,原来打开PNG是保持不变
$hGraphic1 = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $hGraphic1)
$hGraphic2 = _GDIPlus_ImageGetGraphicsContext($hBitmap)
;绘制原图到新创建的位图
Switch $State
Case "normal"
Case "pressed"
Switch $Case
Case 1
$Image[1] = $IE3
Case 2
$Image[2] = $diannao3
Case 3
$Image[3] = $QQ3
Case 4
$Image[4] = $WD3
Case 5
$Image[5] = $gj3
Case 10
$Image[10] = $PressedImage_xoyo
Case 11
$Image[12] = $PressedImage_Exit
EndSwitch
Case "over"
Switch $Case
Case 1
$Image[1] = $IE2
Case 2
$Image[2] = $diannao2
Case 3
$Image[3] = $QQ2
Case 4
$Image[4] = $WD2
Case 5
$Image[5] = $gj2
Case 10
$Image[10] = $OverImage_xoyo
Case 11
$Image[12] = $OverImage_Exit
EndSwitch
EndSwitch
For $i = 1 To 5
_GDIPlus_GraphicsDrawImageRect($hGraphic2, $Image[$i], ($i - 1) * 101, 0, 100, 100)
Next
_GDIPlus_GraphicsDrawImageRect($hGraphic2, $Image[12], 505, 0, 57, 52)
_GDIPlus_GraphicsDrawImageRect($hGraphic2, $Image[10], 505, 55, 57, 52)
;清理不再需要的资源
_GDIPlus_GraphicsDispose($hGraphic2)
_GDIPlus_GraphicsDispose($hGraphic1)
;返回新的位图
Return $hBitmap
EndFunc ;==>_ImageDraw
|