l8532001 发表于 2012-5-5 17:32:59

界面不错。。。。。。。。。

ooxxgod 发表于 2012-5-6 09:21:44

进度条 要改改

770317321 发表于 2012-5-28 12:13:57

这个不错。。。。。。。。。

770317321 发表于 2012-5-28 12:14:13

下载了看看之前也写过累死的

zc333 发表于 2012-10-8 23:21:22

飘过的说。。。。。。。。。没什么实际意义

weeks1 发表于 2012-10-9 08:12:56

支持一下,

xms77 发表于 2012-10-9 12:35:29

顶一下,希望楼主开放源码让大家学习一下,共同进步啊!

ahcoke 发表于 2012-10-10 10:13:38

{:face (301):}牛人啊

seniors 发表于 2012-10-12 14:27:10

回复 1# shenrenba
播放时,鼠标移到音量出错。
桌面歌词字迹不清,我的后续修改版好像是清晰的了,桌面歌词为什么没放入移动功能?

shenrenba 发表于 2012-10-13 09:10:00

回复 54# seniors


    我试了下我这音量没出错
   下面是歌词的代码   我没发现问你要不你看看吧
#include <Array.au3>
#include <GdiPlus.au3>
#include <GDIPlusEx.au3>
#include <sound.au3>
#include <WindowsConstants.au3>
Global $lrcsm = "桌面歌词 by seniors"
Global $outlrc = $lrcsm, $Nolrc = False, $gecisize = 38
;   播放区域数组,歌词存放数组,计时       ,当前歌词在数组中的序,拖动进度获取进度时间
Local $kalaXY, $kalageci, $startlrct, $startlrci = 1, $startlrctemp = 0
Global $kalacolor = [,,,,]
Global $hPen ;;歌词描边用画笔
Global $hBrushTitle ;;正常歌词填充画刷,1为竖直方向渐变
Global $hBrushTitlekala ;卡拉OK画刷
Global $nowopen = 1;现在播放了这句歌词的百分数
Local $taskpos = WinGetPos("");获取任务栏
;       主界面,       宽度,      高度
Global $desklrc_gui, $desklrc_width, $desklrc_height
;       歌词界面,       宽度,               高度
Global $desklrc_gui_lrc, $desklrc_lrc_width, $desklrc_lrc_height

#region
;界面
OnAutoItExitRegister("_exit")
$desklrc_width = 219
$desklrc_height=28
$desklrc_lrc_width = $taskpos - 400
$desklrc_lrc_height = $gecisize + 6 + $desklrc_height
$desklrc_gui = GUICreate("", $desklrc_width, $desklrc_height, ($taskpos - $desklrc_width) / 2, $taskpos - $desklrc_height - $gecisize, $WS_POPUP, $WS_EX_LAYERED, WinGetHandle(AutoItWinGetTitle()))
$desklrc_gui_lrc = GUICreate("", $desklrc_lrc_width, $gecisize + 6, -400, $desklrc_height, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD, $WS_EX_TOPMOST), $desklrc_gui)
GUISetState(@SW_HIDE, $desklrc_gui)
GUISetState(@SW_SHOW, $desklrc_gui_lrc)
_GDIPlus_Startup()
pencolor(0)
showgeci()

;以下为测试代码
Local $mp3path="D:\music\郑智化 - 水手.mp3"
Local $lrcpath=@ScriptDir&"\Lyric\郑智化 - 水手.lrc"
Local $mp3open=_SoundOpen($mp3path)
_SoundPlay($mp3open)
$startlrct=TimerInit()
LoadLrc($lrcpath)
AdlibRegister("startlrc",200)
Do
        Sleep(100)
Until GUIGetMsg()=-3
Func _exit()
        _GDIPlus_Shutdown()
        Exit
        EndFunc
#endregion

;歌词文件分类存入数组$kalageci,数组最后序为歌曲的总时间
Func LoadLrc($lrc_path)
        Local $str = FileRead($lrc_path)
        If @error Then
                $Nolrc = True
                $outlrc = $lrcsm
                FileClose($lrc_path)
                Return SetError(0)
        EndIf
        $Nolrc = False
        FileClose($lrc_path)
        ReDim $kalageci
        $kalageci = 0
        Local $maxtime = 1, $temp_str
        Local $aStr = StringRegExp($str, '\[(\d{2}:\d{2}.\d{2})\]([^\r\n]*)', 3)
        For $i = 0 To UBound($aStr) - 1 Step 2
                $kalageci[$maxtime] = Execute(StringLeft($aStr[$i], 2) * 60 + StringTrimLeft($aStr[$i], 3))
                If StringRegExpReplace($aStr[$i + 1], "\s", "") = "" Then
                        $kalageci[$maxtime] = "MUSIC"
                Else
                        Local $sstr = StringRegExp($aStr[$i + 1], '\[(\d{2}:\d{2}.\d{2})\]', 3)
                        If @error Then
                                $kalageci[$maxtime] = $aStr[$i + 1]
                        Else
                                $temp_str = StringRegExpReplace($aStr[$i + 1], '\[(\d{2}:\d{2}.\d{2})\]', "")
                                If StringRegExpReplace($temp_str, "\s", "") = "" Then $temp_str = "MUSIC"
                                $kalageci[$maxtime] = $temp_str
                                For $ii = 0 To UBound($sstr) - 1
                                        $maxtime += 1
                                        ReDim $kalageci[$maxtime+1]
                                        $kalageci[$maxtime] = Execute(StringLeft($sstr[$ii], 2) * 60 + StringTrimLeft($sstr[$ii], 3))
                                        $kalageci[$maxtime] = $temp_str
                                Next
                        EndIf
                EndIf
                $maxtime += 1
                ReDim $kalageci[$maxtime+1]
        Next
        $kalageci[$maxtime]=9999
        _ArraySort($kalageci)
EndFunc   ;==>LoadLrc

Func startlrc()
        ;歌词显示处理
        For $ii = 1 To UBound($kalageci) - 2
                ;调整歌曲进度时获取当前播放的歌词
                If (Round(TimerDiff($startlrct) / 1000 + $startlrctemp) < Round($kalageci[$ii])) And (Round(TimerDiff($startlrct) / 1000 + $startlrctemp) > Round($kalageci[$ii - 1])) Then
                        $outlrc = $kalageci[$ii - 1]
                        $startlrci = $ii
                EndIf
                ;正常播放时获取
                If (Round(TimerDiff($startlrct) / 1000 + $startlrctemp) == Round($kalageci[$ii])) And ($kalageci[$ii] <> $outlrc) Then
                        $outlrc = $kalageci[$ii]
                        $startlrci = $ii + 1
                        ExitLoop
                EndIf
        Next
        kalaok()
EndFunc   ;==>startlrc

Func kalaok()
        If $Nolrc Then Return
        ;为了让进度完美点-0.8
        $nowopen = (TimerDiff($startlrct) / 1000 + $startlrctemp - $kalageci[$startlrci - 1]) / ($kalageci[$startlrci] - $kalageci[$startlrci - 1] - 0.8)
        showgeci()
EndFunc   ;==>kalaok

;以下为seniors代码
Func pencolor($ji)
        Local $tRect = _GDIPlus_RectFCreate(0, 0, 40, $gecisize);设置区域色块
        $hPen = _GDIPlus_PenCreate($kalacolor[$ji], 2, 0);歌词描边用画笔
        $hBrushTitle = _GDIPlus_LineBrushCreateFromRect($tRect, $kalacolor[$ji], $kalacolor[$ji], 1, 3);正常歌词填充画刷,1为竖直方向渐变
        $hBrushTitlekala = _GDIPlus_LineBrushCreateFromRect($tRect, $kalacolor[$ji], $kalacolor[$ji], 1, 3);卡拉OK画刷
EndFunc   ;==>pencolor
Func showgeci()
        geci($outlrc, "黑体", $gecisize, $hBrushTitle, $hPen, $hBrushTitlekala, $nowopen)
EndFunc   ;==>showgeci
Func geci($sString, $sFont, $nSize, $hBrush, $hPenB, $hBrushkala, $pencent)
        Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($desklrc_gui_lrc)
        Local $hFormat = _GDIPlus_StringFormatCreate(0x0004)
        _GDIPlus_StringFormatSetAlign($hFormat, 1);1为设置歌词居中显示
        Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
        Local $tLayout, $hPath
        $tLayout = _GDIPlus_RectFCreate(0, 6, $desklrc_lrc_width, $gecisize + 6)
        Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($desklrc_lrc_width, $gecisize + 6, $hGraphics)
        Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
        _GDIPlus_GraphicsClear($hContext, 0x00000000)
        DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "hwnd", $hContext, "int", 4)
        $hPath = _GDIPlus_PathCreate()
        _GDIPlus_PathAddString($hPath, $sString, $tLayout, $hFamily, 0, $nSize, $hFormat);读取歌词外形为路径;0是正常字,38是字号
        DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hContext, "hwnd", $hPenB, "hwnd", $hPath);字体描边
        DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hContext, "hwnd", $hBrush, "hwnd", $hPath)
        Local $kalareg = _GDIPlus_RegionCreateFromPath($hPath);歌词路径转换为区域
        Local $kalaXY = _GDIPlus_PathGetWorldBounds($hPath);歌词的区域范围
        Local $tkalaRect = _GDIPlus_RectFCreate($kalaXY, $kalaXY, $kalaXY * $pencent, $kalaXY);设置已播放区域
        Local $pkalaRect = DllStructGetPtr($tkalaRect)
        DllCall($ghGDIPDll, "uint", "GdipCombineRegionRect", "hwnd", $kalareg, "ptr", $pkalaRect, "int", 1);获得已播放区域和歌词区域的交集,1为交集
        DllCall($ghGDIPDll, "uint", "GdipFillRegion", "hwnd", $hContext, "hwnd", $hBrushkala, "hwnd", $kalareg)
        _GDIPlus_RegionDispose($kalareg)
        _GDIPlus_PathDispose($hPath)
        _GDIPlus_FontFamilyDispose($hFamily)
        _GDIPlus_StringFormatDispose($hFormat)
        _GDIPlus_GraphicsDispose($hContext)
        SetBitmap($desklrc_gui_lrc, $hBitmap, 255)
        _GDIPlus_BitmapDispose($hBitmap)
        _GDIPlus_GraphicsDispose($hGraphics)
EndFunc   ;==>geci
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", 1)
        _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

qq342252004 发表于 2012-10-13 14:23:39

看不到频谱

seniors 发表于 2012-10-13 20:36:19

回复 56# shenrenba
可能上班用的笔记本不对,在家里歌词窗口没出现什么问题
下面代码帮你增加了背景透明灰窗口,并且让窗口可以移动,去除了一些多余变量
字迹更加光滑处理
#include <Array.au3>
#include <GdiPlus.au3>
#include <GDIPlusEx.au3>
#include <sound.au3>
#include <WindowsConstants.au3>
Global $lrcsm = "桌面歌词 by seniors"
Global $outlrc = $lrcsm, $Nolrc = False, $gecisize = 38
;   播放区域数组,歌词存放数组,计时       ,当前歌词在数组中的序,拖动进度获取进度时间
Local $kalaXY, $kalageci, $startlrct, $startlrci = 1, $startlrctemp = 0
Global $kalacolor = [,,,,]
Global $hPen ;;歌词描边用画笔
Global $hBrushTitle ;;正常歌词填充画刷,1为竖直方向渐变
Global $hBrushTitlekala ;卡拉OK画刷
Global $nowopen = 1;现在播放了这句歌词的百分数
Local $taskpos = WinGetPos("");获取任务栏
;       歌词界面,       宽度,               高度
Global $desklrc_gui_lrc, $desklrc_lrc_width, $desklrc_lrc_height

#region
;界面
OnAutoItExitRegister("_exit")
$desklrc_lrc_width = $taskpos - 400
$desklrc_lrc_height = $gecisize + 6
$desklrc_gui = GUICreate("", $desklrc_lrc_width, $desklrc_lrc_height, ($taskpos - $desklrc_lrc_width) / 2, $taskpos - $desklrc_lrc_height, $WS_POPUP, $WS_EX_LAYERED, WinGetHandle(AutoItWinGetTitle()))
$desklrc_gui_lrc = GUICreate("", $desklrc_lrc_width, $desklrc_lrc_height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD, $WS_EX_TOPMOST), $desklrc_gui)
GUISetState(@SW_HIDE, $desklrc_gui)
GUISetState(@SW_SHOW, $desklrc_gui_lrc)
GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST')
GUIRegisterMsg($WM_NCMOUSEMOVE, 'WM_NCMOUSEMOVE')
Global Const $WM_NCMOUSELEAVE = 0x02A2
GUIRegisterMsg($WM_NCMOUSELEAVE, 'WM_NCMOUSELEAVE')
GUIRegisterMsg($WM_MOVE, 'WM_MOVE')
GUISetCursor(0, 1, $desklrc_gui)
_GDIPlus_Startup()
beijing()
pencolor(0)
showgeci()

;以下为测试代码
Local $mp3path = @ScriptDir & "\陈奕迅-好久不见.mp3"
Local $lrcpath = @ScriptDir & "\陈奕迅-好久不见.lrc"
Local $mp3open = _SoundOpen($mp3path)
_SoundPlay($mp3open)
$startlrct = TimerInit()
LoadLrc($lrcpath)
AdlibRegister("startlrc", 200)
Do
        Sleep(100)
Until GUIGetMsg() = -3
Func _exit()
        _GDIPlus_Shutdown()
        Exit
EndFunc   ;==>_exit
#endregion

Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam)
        Switch $hWnd
                Case $desklrc_gui
                        Return $HTCAPTION;返回这值让窗口可以移动
                Case $desklrc_gui_lrc
                        GUISetState(@SW_SHOW, $desklrc_gui);当鼠标在歌词上时显示透明灰背景窗口
                        Return $HTTRANSPARENT
        EndSwitch
EndFunc   ;==>WM_NCHITTEST

Func WM_NCMOUSEMOVE($hWnd, $Msg, $wParam, $lParam)
        Switch $hWnd
                Case $desklrc_gui
                        _WinAPI_TrackMouseEvent($hWnd, 0x00000012);鼠标移出时返回WM_NCMOUSELEAVE消息 
        EndSwitch
EndFunc   ;==>WM_NCMOUSEMOVE

Func WM_NCMOUSELEAVE($hWnd, $Msg, $wParam, $lParam)
        Switch $hWnd
                Case $desklrc_gui
                        GUISetState(@SW_HIDE, $desklrc_gui);鼠标移出,透明灰背景窗口隐藏
        EndSwitch
EndFunc   ;==>WM_NCMOUSELEAVE

Func WM_MOVE($hWnd, $Msg, $wParam, $lParam)
        Switch $hWnd
                Case $desklrc_gui
                        GUISetState(@SW_SHOW, $desklrc_gui);窗口移动时,显示透明灰背景窗口
        EndSwitch
EndFunc   ;==>WM_MOVE

;歌词文件分类存入数组$kalageci,数组最后序为歌曲的总时间
Func LoadLrc($lrc_path)
        Local $str = FileRead($lrc_path)
        If @error Then
                $Nolrc = True
                $outlrc = $lrcsm
                FileClose($lrc_path)
                Return SetError(0)
        EndIf
        $Nolrc = False
        FileClose($lrc_path)
        ReDim $kalageci
        $kalageci = 0
        Local $maxtime = 1, $temp_str
        Local $aStr = StringRegExp($str, '\[(\d{2}:\d{2}.\d{2})\]([^\r\n]*)', 3)
        For $i = 0 To UBound($aStr) - 1 Step 2
                $kalageci[$maxtime] = Execute(StringLeft($aStr[$i], 2) * 60 + StringTrimLeft($aStr[$i], 3))
                If StringRegExpReplace($aStr[$i + 1], "\s", "") = "" Then
                        $kalageci[$maxtime] = "MUSIC"
                Else
                        Local $sstr = StringRegExp($aStr[$i + 1], '\[(\d{2}:\d{2}.\d{2})\]', 3)
                        If @error Then
                                $kalageci[$maxtime] = $aStr[$i + 1]
                        Else
                                $temp_str = StringRegExpReplace($aStr[$i + 1], '\[(\d{2}:\d{2}.\d{2})\]', "")
                                If StringRegExpReplace($temp_str, "\s", "") = "" Then $temp_str = "MUSIC"
                                $kalageci[$maxtime] = $temp_str
                                For $ii = 0 To UBound($sstr) - 1
                                        $maxtime += 1
                                        ReDim $kalageci[$maxtime + 1]
                                        $kalageci[$maxtime] = Execute(StringLeft($sstr[$ii], 2) * 60 + StringTrimLeft($sstr[$ii], 3))
                                        $kalageci[$maxtime] = $temp_str
                                Next
                        EndIf
                EndIf
                $maxtime += 1
                ReDim $kalageci[$maxtime + 1]
        Next
        $kalageci[$maxtime] = 9999
        _ArraySort($kalageci)
EndFunc   ;==>LoadLrc

Func startlrc()
        ;歌词显示处理
        For $ii = 1 To UBound($kalageci) - 2
                ;调整歌曲进度时获取当前播放的歌词
                If (Round(TimerDiff($startlrct) / 1000 + $startlrctemp) < Round($kalageci[$ii])) And (Round(TimerDiff($startlrct) / 1000 + $startlrctemp) > Round($kalageci[$ii - 1])) Then
                        $outlrc = $kalageci[$ii - 1]
                        $startlrci = $ii
                EndIf
                ;正常播放时获取
                If (Round(TimerDiff($startlrct) / 1000 + $startlrctemp) == Round($kalageci[$ii])) And ($kalageci[$ii] <> $outlrc) Then
                        $outlrc = $kalageci[$ii]
                        $startlrci = $ii + 1
                        ExitLoop
                EndIf
        Next
        kalaok()
EndFunc   ;==>startlrc

Func kalaok()
        If $Nolrc Then Return
        ;为了让进度完美点-0.8
        $nowopen = (TimerDiff($startlrct) / 1000 + $startlrctemp - $kalageci[$startlrci - 1]) / ($kalageci[$startlrci] - $kalageci[$startlrci - 1] - 0.8)
        showgeci()
EndFunc   ;==>kalaok

;以下为seniors代码
Func pencolor($ji)
        Local $tRect = _GDIPlus_RectFCreate(0, 0, 40, $gecisize);设置区域色块
        $hPen = _GDIPlus_PenCreate($kalacolor[$ji], 2, 0);歌词描边用画笔
        $hBrushTitle = _GDIPlus_LineBrushCreateFromRect($tRect, $kalacolor[$ji], $kalacolor[$ji], 1, 3);正常歌词填充画刷,1为竖直方向渐变
        $hBrushTitlekala = _GDIPlus_LineBrushCreateFromRect($tRect, $kalacolor[$ji], $kalacolor[$ji], 1, 3);卡拉OK画刷
EndFunc   ;==>pencolor
Func showgeci()
        geci($outlrc, "黑体", $gecisize, $hBrushTitle, $hPen, $hBrushTitlekala, $nowopen)
EndFunc   ;==>showgeci
Func geci($sString, $sFont, $nSize, $hBrush, $hPenB, $hBrushkala, $pencent)
        Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($desklrc_gui_lrc)
        Local $hFormat = _GDIPlus_StringFormatCreate(0x0004)
        _GDIPlus_StringFormatSetAlign($hFormat, 1);1为设置歌词居中显示
        Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
        Local $tLayout, $hPath
        $tLayout = _GDIPlus_RectFCreate(0, 6, $desklrc_lrc_width, $gecisize + 6)
        Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($desklrc_lrc_width, $gecisize + 6, $hGraphics)
        Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
        _GDIPlus_GraphicsClear($hContext, 0x00000000)
        ;下面两句是新增加的平滑处理,我一时看不出效果,好像太光滑了
        _GDIPlus_GraphicsSetSmoothingMode($hContext,2);绘制质量 2 - 使用 8 X 8 矩形过滤器
        _GDIPlus_GraphicsSetInterpolationMode($hContext, 7);7=High-quality, bicubic interpolation.
        ;下面这句是原来的一个光滑处理
        DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "hwnd", $hContext, "int", 4)
        $hPath = _GDIPlus_PathCreate()
        _GDIPlus_PathAddString($hPath, $sString, $tLayout, $hFamily, 0, $nSize, $hFormat);读取歌词外形为路径;0是正常字,38是字号
        DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hContext, "hwnd", $hPenB, "hwnd", $hPath);字体描边
        DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hContext, "hwnd", $hBrush, "hwnd", $hPath)
        Local $kalareg = _GDIPlus_RegionCreateFromPath($hPath);歌词路径转换为区域
        Local $kalaXY = _GDIPlus_PathGetWorldBounds($hPath);歌词的区域范围
        Local $tkalaRect = _GDIPlus_RectFCreate($kalaXY, $kalaXY, $kalaXY * $pencent, $kalaXY);设置已播放区域
        Local $pkalaRect = DllStructGetPtr($tkalaRect)
        DllCall($ghGDIPDll, "uint", "GdipCombineRegionRect", "hwnd", $kalareg, "ptr", $pkalaRect, "int", 1);获得已播放区域和歌词区域的交集,1为交集
        DllCall($ghGDIPDll, "uint", "GdipFillRegion", "hwnd", $hContext, "hwnd", $hBrushkala, "hwnd", $kalareg)
        _GDIPlus_RegionDispose($kalareg)
        _GDIPlus_PathDispose($hPath)
        _GDIPlus_FontFamilyDispose($hFamily)
        _GDIPlus_StringFormatDispose($hFormat)
        _GDIPlus_GraphicsDispose($hContext)
        SetBitmap($desklrc_gui_lrc, $hBitmap, 255)
        _GDIPlus_BitmapDispose($hBitmap)
        _GDIPlus_GraphicsDispose($hGraphics)
EndFunc   ;==>geci

Func beijing();歌词后面的透明灰窗口
        Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($desklrc_gui)
        Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($desklrc_lrc_width, $desklrc_lrc_height, $hGraphics)
        Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
        _GDIPlus_GraphicsClear($hContext, 0x33000000)
        SetBitmap($desklrc_gui, $hBitmap, 255)
        _GDIPlus_GraphicsDispose($hContext)
        _GDIPlus_BitmapDispose($hBitmap)
        _GDIPlus_GraphicsDispose($hGraphics)
EndFunc   ;==>beijing
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", 1)
        _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

xinde30sandywl 发表于 2014-8-15 00:09:54

什么冬休啊

樱花雪月 发表于 2014-9-18 18:34:58

路过而已 啊

austere 发表于 2014-9-18 19:09:04

东东不错,记得上次有个人问我关于调节音量的问题,不知道是不是楼主。。。
页: 1 2 3 [4] 5
查看完整版本: 音乐播放器(主要功能已有)