#include <GDIPlus.au3>
#include <GuiComboBox.au3>
#include <File.au3>
#include <Array.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <ButtonConstants.au3>
#include <sound.au3>
#include <Date.au3>
Opt("MustDeclareVars", 0)
$work=0
Dim $neirong[9999]
idopen()
$line_1=0
Dim $shijian
Dim $sjpd
Dim $geshu
$tm=0
$numold=0
$num=0
Global Const $AC_SRC_ALPHA = 1
Global $old_string = "", $runthis = ""
Global $launchDir = @DesktopDir
_GDIPlus_Startup()
$pngSrc = @ScriptDir & "\pifu.png"
$hImage = _GDIPlus_ImageLoadFromFile($pngSrc)
$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)
$GUI = GUICreate("my", $width,$height, -1,-1, $WS_POPUP, $WS_EX_LAYERED)
SetBitmap($GUI, $hImage, 0)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()
WinSetOnTop($GUI, "", 1)
For $i = 0 To 255 Step 10
SetBitmap($GUI, $hImage, $i)
Next
$controlGui = GUICreate("ControlGUI", $width,$height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)
GUICtrlSetBkColor($controlGui , $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel("正在播放 周杰伦-稻香", 50,40, 240, 50)
;GUICtrlSetFont(-1, 12, 400, 0, "方正美黑简体")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label1 = GUICtrlCreateLabel("", 55,110, 214, 50)
GUICtrlSetFont(-1, 12, 400, 0, "方正美黑简体")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Label2 = GUICtrlCreateLabel("", 55,110, 214, 50)
GUICtrlSetFont(-1, 12, 400, 0, "方正美黑简体")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFF0080)
GUISetState()
$sound = _SoundOpen("zhoujielun-daoxiang.mp3")
_SoundPlay($sound)
$work=1
$line_1=0
$data = 0
$begin = TimerInit()
Func rgc($num)
ControlSetText ("",GUICtrlRead($Label2), $Label2, StringMid(StringMid($neirong[$line_1-1],11),1,$num))
EndFunc
While 1
$msg = GUIGetMsg()
$dif = TimerDiff($begin)
$data = $dif/1000
$data = Round($data, 2)
If $work=1 Then
$tm=_SoundPos ( $sound,2)
If $tm>=Int((StringMid($neirong[$line_1],2,2))*60*1000+Int(StringMid($neirong[$line_1],5,2))*1000+Int(StringMid($neirong[$line_1],8,2))) Then
$shijian=Int((StringMid($neirong[$line_1+1],2,2))*60*1000+Int(StringMid($neirong[$line_1+1],5,2))*1000+Int(StringMid($neirong[$line_1+1],8,2)))-Int((StringMid($neirong[$line_1],2,2))*60*1000+Int(StringMid($neirong[$line_1],5,2))*1000+Int(StringMid($neirong[$line_1],8,2)))
GUICtrlSetData($Label1,StringMid($neirong[$line_1],11))
GUICtrlSetFont($Label1, 14, 400, 0, "方正美黑简体")
GUICtrlSetColor($Label1, 0xFFFFFF)
GUICtrlSetBkColor($Label1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetData($Label2,"")
GUICtrlSetFont($Label2, 14, 400, 0, "方正美黑简体")
GUICtrlSetColor($Label2, 0xFF0080)
GUICtrlSetBkColor($Label2, $GUI_BKCOLOR_TRANSPARENT)
$geshu=StringLen(StringMid($neirong[$line_1],11))
If $geshu>0 Then
$sjpd=$shijian/($geshu)
EndIf
$line_1+=1
EndIf
;------------------------------------------------------------------红字歌词循环
$num=Ceiling($geshu-(Int((StringMid($neirong[$line_1],2,2))*60*1000+Int(StringMid($neirong[$line_1],5,2))*1000+Int(StringMid($neirong[$line_1],8,2)))-$tm)/$sjpd)
If $num>=0 And $num <> $numold And $line_1>0 Then
ControlSetText("",GUICtrlRead($Label2), $Label2, StringMid(StringMid($neirong[$line_1-1],11),1,$num))
$numold =$num
EndIf
;------------------------------------------------------------------
If $tm=_SoundLength ( $sound,2) Then _SoundClose ( $sound )
EndIf
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
GUIDelete($controlGui)
For $i = 255 To 0 Step -10
SetBitmap($GUI, $hImage, $i)
Next
_WinAPI_DeleteObject($hImage)
_GDIPlus_Shutdown()
Func GoAutoComplete()
_GUICtrlComboBox_AutoComplete($Combo)
EndFunc
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc
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
Func _ShellExecute($sCmd, $sArg = "", $sFolder = "", $rState = @SW_SHOWNORMAL)
$aRet = DllCall("shell32.dll", "long", "ShellExecute", _
"hwnd", 0, _
"string", "", _
"string", $sCmd, _
"string", $sArg, _
"string", $sFolder, _
"int", $rState)
If @error Then Return 0
$RetVal = $aRet[0]
If $RetVal > 32 Then
Return 1
Else
Return 0
EndIf
EndFunc
Func idopen()
$var="稻香.lrc"
If $var<>"" Then
Local $aArray
_FileReadToArray ( $var, $aArray)
For $i=0 To $aArray[0]-1
If $aArray[$i+1]="" Then ExitLoop
$neirong[$i]=$aArray[$i+1]
Next
EndIf
EndFunc
各位大叔大婶,小弟感觉这个播放器挺好玩的,但是发现LRC显示的时候闪烁严重。